= 20200414){$bw_on = “yes”;}
if($j_date >= 20190413){$su_on = “yes”;}
$current_user = wp_get_current_user();
# echo ‘User ID: ‘ . $current_user->ID . “\n”;
#######################################
# IF FORM SUBMITTED #
#######################################
if ($_SERVER[‘REQUEST_METHOD’] == ‘POST’){
$hick=”und”;
#######################################
# TAKING CARE OF CARD ENTRY #
#######################################
if (!empty($_POST[‘card’] )){
#echo $_POST[‘card’];
list($ast2, $ast1) = explode(“(“, $_POST[‘card’]);
$ast1= substr_replace($ast1, “”, -1);
$ast = explode(” “, $ast2);
$aaad= substr_replace($ast[0], “”, -1); $aaad = substr($aaad, 1);
list($aaa, $bbb)= explode(“-“, $aaad);
if (“$ast[1] $ast[2]” == “Be Well”){$hick=1;}elseif(“$ast[1] $ast[2]” == “Step Up”){$hick=2;}else{}
$j_gg = “INSERT INTO binding(wid,bwsuid,cnum,email,start,end)VALUES($current_user->ID,$hick,$ast[5],\”$ast1\”,$aaa, $bbb)”;
#echo $j_gg;
$j_rgg = mysql_query($j_gg);
if($j_rgg){
echo “
}else{
echo “
}
}
if (!empty($_POST[‘submit_both’] )){
$mon=$tue=$nev=$cnev=$cnen=$waiting=””;
$wow=array();
$roww= “SELECT * FROM steps_weight WHERE wid= “.$current_user->ID.””;
$nev = mysql_query( “SELECT * FROM steps_weight WHERE wpid= “.$current_user->ID.”” );
$cnev = mysql_num_rows($nev);
while ($cnen=mysql_fetch_row( $nev ) ){list($mon, $tue)=explode(” “, $cnen[4]); echo “mon: “.$mon. “
“; array_push($wow, $mon);}
$punk= date(‘Y-m-d’);
if (in_array($punk, $wow)) {
echo “
}else{
$nonce= rand(10, 60);
$jtsa= date(‘YmdHis’);
$nnumm = $jtsa.$nonce;
$love_a = “INSERT INTO steps_weight (swid, cid, bwsuid, wpid, ts, steps, weight) VALUES ($nnumm,1000,”.$_POST[‘whoish’].”,”.$current_user->ID.”,CURRENT_TIMESTAMP, “.$_POST[‘sboth’].”, “.$_POST[‘wboth’].”)”;
$j_rlove = mysql_query($love_a);
if($j_rlove){
echo “
}else{
echo “
}
}#no dup
}#if steps entered
if (!empty($_POST[‘subup’] )){
$uall= “UPDATE steps_weight SET steps = “.$_POST[‘usteps’].”, weight = “.$_POST[‘uweight’].” WHERE swid = “.$_POST[‘uswid’].” AND cid =”.$_POST[‘ucid’].” AND bwsuid =”.$_POST[‘ubwsuid’].” AND wpid =”.$_POST[‘uwpid’].”;”;
#echo $uall;
$ruall = mysql_query($uall);
if($ruall){
echo “
}else{
echo “
}
}#if update
}else{#if not post then carry on
$bwopt = $suopt = $ww = array();
$bw = “no”;
$su= “no”;
$go = “yes”;
$bwho = mysql_query( “SELECT * FROM `binding` WHERE `wid` = $current_user->ID” );
$c_jyan = mysql_num_rows($bwho);
#########################################
# CHECK TO SEE IF ALL READY BINDED CARD #
#########################################
while ($bs=mysql_fetch_row( $bwho ) ){array_push($ww, $bs[1]);}
if (in_array(1, $ww)) {$bw = “yes”;}
if (in_array(2, $ww)) {$su = “yes”;}
#CHECK WHAT RECORDS NEED TO BE VERIFIED IN CSV
if ($c_jyan < 2){
$rr = getrecords($current_user->user_email);
#var_dump ($rr);
$nn= 1;
foreach ($rr as $blah){
#echo $nn.”. “.$blah;
if (ereg (“Be Well Card”, $blah)){array_push($bwopt, $blah);}
if (ereg (“Step Up Card”, $blah)){array_push($suopt, $blah);}
$nn++;
}
if ((count($bwopt) <1)&&(count($suopt) <1)){
echo" [su_service title=\"You need to be enrolled to log your steps and weight.\" icon=\"icon: hand-o-right\" icon_color=\"#004000\"]
Looks like you have not enrolled yet. Enroll Now!
[/su_service]
echo “

“;
}else{
if (($bw ==”no”)||($bw ==”no”)){
if ((count($bwopt) >=1)||(count($suopt) >=1)){
echo” ";
}}
#########################################
# PRINT OUT YOUR CONFIRMATION BOXES #
#########################################
echo "";
if ($bw =="no"){
if (count($bwopt) >0){
echo "
$go = "no";
}#elsego
}#elsego
if ($su =="no"){
if (count($suopt) >0){
echo "
$go = "no";
}#elsego
}#elsego
echo "
}#NEWBIE?
} elseif($c_jyan == 2){
if (($bw=="yes")&&($su=="yes")){ $go = "yes";
}else{
echo "
$go = "no";
}
}else{$go = "no";echo "ERROR - You have Dups";}
##########################
# DISPLAY OPEN CLOSE #
##########################
if ($bw_on =="yes"){$j_bwmesg="is open";}else{$j_bwmesg="opens April 8, 2017";}
if ($su_on =="yes"){$j_sumesg="is open";}else{$j_sumesg="opens April 13, 2019";}
?>
";
####################################################LET THEM HAVE CAKE...OH AND LOG TOO###################################################
if ($go == "yes"){
echo "
?>
ID, 121 ); ?>
user_firstname.” “.$current_user->user_lastname.”!
Status: You are enrolled in “.$c_jyan.” account(s).
“;
echo ‘Username: ‘ . $current_user->user_login . ‘
‘;
echo ‘User Email: ‘ . $current_user->user_email . ‘
‘;
echo ‘User display name:
ID ORDER BY ts” );
$jil_num5 = mysql_num_rows( $j_res5 );
$jcomp= date(‘Y-m-d’);
$bwlogged =$slogged=”no”;
$whatb=$whats=array();
$sutslogged =$bwtslogged =$jrows = “”;
$snot=0;
while ( $aj = mysql_fetch_row( $j_res5 ) ){
$jrows= “
Lightbox: please specify correct source
“;
if ($aj[2] ==1){array_push($whatb, $jrows);}
if ($aj[2] ==2){array_push($whats, $jrows);}
list ($j_day, $j_time) = explode (” “, $aj[4]);
#echo $j_day.” and “. $jcomp. “
“;
if ($j_day == $jcomp){
if ($aj[2] == 1){$bwlogged = “yes”; $bwtslogged = $aj[4];}
if ($aj[2] == 2){$slogged = “yes”; $sutslogged = $aj[4];}
}
$snot++;
}
?>
![]() |
Enter Steps: | Enter Weight: |
}
}else{
echo “
}#is open
}#if in contest
##########################
# DISPLAY SU FORM #
##########################
if ($su==”yes”){
if ($su_on == “yes”){
if ($slogged == “yes”){
echo “
}else{
echo “
}#if inputted anything today
}else{
echo “
}#is open
}#if in contest
##########################
# DISPLAY BW TABLE #
##########################
if ($bw == “yes”){
if ($bw_on == “yes”){
echo ““;
print “