Walk Entry


Click Here To View Your Walk History              Click Here To Read Blog Articles

user_login;
$walker_n = $current_user->user_firstname;
$measure = get_cimyFieldValue($current_user->ID, ‘MEASUREMENT’);
$nmeasure = cimy_uef_sanitize_content($measure);
if ($nmeasure == “Kilometers”){
$lentext = “km”;
$distance = round($i->distance * 1.609344, 2);
$weighttext = “kg”;
$weight = round($i->weight * 0.45359237, 2);
$multi = 1.609344;
$wmulti = 0.45359237;
} else {
$lentext = “miles”;
$distance = $i->distance;
$weighttext = “lbs”;
$weight = $i->weight;
$multi = 1;
$wmulti = 1;
}
if (isset($_POST[“user_login”]) && $_POST[“user_login”] != “”) {
$datearr = split(“/”, $_POST[“date”]);
$sqldate = “‘”.$datearr[2].”-“.$datearr[0].”-“.$datearr[1].”‘”;
if ($_POST[“user_edit”] != “0”) {
$realdis = round($_POST[“distance”] / $multi, 2);
$realweight = round($_POST[“weight”] / $wmulti, 2);
if (isset($_POST[“steps”]) && $_POST[“steps”] != “”) {
$steps = $_POST[“steps”];
} else {
$steps = “NULL”;
}
if (isset($_POST[“weight”]) && $_POST[“weight”] != “”) {
$realweight = round($_POST[“weight”] / $wmulti, 2);
} else {
$realweight = “NULL”;
}
if (isset($_POST[“location”]) && $_POST[“location”] != “”) {
$location = $_POST[“location”];
} else {
$location = “NULL”;
}
if (isset($_POST[“walkers_spotted”]) && $_POST[“walkers_spotted”] != “”) {
$walkers = $_POST[“walkers_spotted”];
} else {
$walkers = “NULL”;
}
$sql = “UPDATE user_walk SET date=”.$sqldate.”, duration=”.$_POST[“duration”].”, distance=”.$realdis.”, steps=”.$steps.”, weight=”.$realweight.”, location=”.$_POST[“location”].”, walkers_spotted=”.$_POST[“walkers_spotted”].” WHERE id = “.$_POST[“user_edit”];
$sql = “UPDATE user_walk SET date=”.$sqldate.”, duration=”.$_POST[“duration”].”, distance=”.$realdis.”, steps=”.$steps.”, weight=”.$realweight.”, location='”.$location.”‘, walkers_spotted=”.$walkers.” WHERE id = “.$_POST[“user_edit”];
$wpdb->query($sql);
echo “

Record has been updated

“;
} else {

$sqlcolumns = array();
$sqldata = array();
array_push($sqlcolumns, “user_login”);
array_push($sqldata, “‘”.$_POST[“user_login”].”‘”);
array_push($sqlcolumns, “date”);
array_push($sqldata, $sqldate);
array_push($sqlcolumns, “duration”);
array_push($sqldata, “‘”.$_POST[“duration”].”‘”);
array_push($sqlcolumns, “distance”);
$realdis = round($_POST[“distance”] / $multi, 2);
array_push($sqldata, “‘”.$realdis.”‘”);
if (isset($_POST[“steps”]) && $_POST[“steps”] != “”) {
array_push($sqlcolumns, “steps”);
array_push($sqldata, “‘”.$_POST[“steps”].”‘”);
}
if (isset($_POST[“weight”]) && $_POST[“weight”] != “”) {
array_push($sqlcolumns, “weight”);
$realweight = round($_POST[“weight”] / $wmulti, 2);
array_push($sqldata, “‘”.$realweight.”‘”);
}
if (isset($_POST[“location”]) && $_POST[“location”] != “”) {
array_push($sqlcolumns, “location”);
array_push($sqldata, “‘”.$_POST[“location”].”‘”);
}
if (isset($_POST[“walkers_spotted”]) && $_POST[“walkers_spotted”] != “”) {
array_push($sqlcolumns, “walkers_spotted”);
array_push($sqldata, “‘”.$_POST[“walkers_spotted”].”‘”);
}
if (isset($_POST[“money_found”]) && $_POST[“money_found”] != “”) {
array_push($sqlcolumns, “money_found”);
array_push($sqldata, “‘”.$_POST[“money_found”].”‘”);
}
if (isset($_POST[“weather”]) && $_POST[“weather”] != “”) {
array_push($sqlcolumns, “weather”);
array_push($sqldata, “‘”.$_POST[“weather”].”‘”);
}
$coltext = implode(“, “, $sqlcolumns);
$dattext = implode(“, “, $sqldata);
$sql = “INSERT INTO user_walk ($coltext) VALUES ($dattext)”;
$wpdb->query($sql);
}
} else {
echo “Please enter information on your recent walks, “.$walker_n.”
“;
$editid = 0;
if (isset($_GET[“edit”]) && $_GET[“edit”] != “”) {
$editid = $_GET[“edit”];
global $wpdb;
$isthisme = $wpdb->get_row(“SELECT user_login FROM user_walk WHERE id = “.$editid);
if ($isthisme->user_login == $walker_u OR current_user_can(‘level_10’)) {
$edit = $wpdb->get_row(“SELECT date, duration, distance, steps, weight, location, walkers_spotted FROM user_walk WHERE id = “.$editid);
$datearr = split(“-“, $edit->date);
$val_date = $datearr[1].”/”.$datearr[2].”/”.$datearr[0];
$val_duration = $edit->duration;
$val_distance = $edit->distance;
$val_steps = $edit->steps;
$val_weight = $edit->weight;
$val_location = $edit->location;
if ($val_location == “NULL”) {
$val_location = “”;
}
$val_walkers = $edit->walkers;
} else {
$editid = 0;
echo “

This isn’t your record. You cannot edit it

“;
}
} else {
$useredit = 0;
$val_date = “”;
$val_duration = “”;
$val_distance = “”;
$val_steps = “”;
$val_weight = “”;
$val_location = “”;
$val_walkers = “”;
}

?>

Walk Date* example: xx/xx/xxxx
Duration (in minutes)*  

* required field

You must Log In or Register Before You Can Enter Statistics

“;
}?>

Log In By Clicking Here

Register By Clicking Here