Esempio n. 1
0
        if ($steps >= 7000) {
            // add steps to streak total
            $total = $total + $steps;
            $count++;
            if ($count == 8) {
                $count = 1;
                pointConversion($conn, $total, $userid);
                $total = 0;
            }
        } else {
            $count = 1;
            $total = 0;
        }
    } else {
        // store streak counter and total and update start date
        setCount($conn, $userid, $count);
        setTotal($conn, $userid, $total);
        setStartDate($date, $conn, $userid);
        break;
    }
    $tmp = strtotime("+1 day", $datets);
    $date = date("Y-m-d", $tmp);
}
function pointConversion($conn, $total, $id)
{
    $before = getPoints($conn, $id);
    $points = 0;
    if ($total >= 49000 && $total <= 69999) {
        $points = 10;
    } else {
        if ($total >= 70000 && $total <= 90999) {
Esempio n. 2
0
$retType = null;
if (isset($_GET['r'])) {
    $retType = $_GET["r"];
} else {
    if (isset($_POST['r'])) {
        $retType = $_POST["r"];
    }
}
$tbName = array();
$findData = array();
$args = array();
switch ($retType) {
    case "q":
        global $tbName;
        $tbName[] = "questions";
        break;
    case "qa":
        global $tbName;
        $tbName[] = "questions";
        $tbName[] = "answers";
    case "vc":
        global $tbName;
        $tbName[] = "questions";
}
//print_r(findData($tbName));
if ($retType != "vc") {
    $jsonData = findData($tbName);
    print_r(json_encode($jsonData));
} else {
    setCount($tbName);
}