示例#1
0
<?php

require '../model/healthService.class.php';
if (is_array($_GET) && count($_GET) > 0) {
    if (isset($_GET["operation"])) {
        if ($_GET['operation'] == 1) {
            session_start();
            $username = $_SESSION["username"];
            $height = $_POST['height'];
            $weight = $_POST['weight'];
            $res = HealthService::addHW($username, $height, $weight);
            echo $res;
            if ($res) {
                header("Location: http://localhost/healthyone/view/health.php?success=1");
                exit;
            } else {
                header("Location: http://localhost/healthyone/view/health.php?errno=1");
                exit;
            }
        } else {
            if ($_GET['operation'] == 2) {
                $date = $_POST['date'];
                header("Location: http://localhost/healthyone/view/sleep.php?date={$date}");
            } else {
                if ($_GET['operation'] == 3) {
                    $date = $_POST['date'];
                    header("Location: http://localhost/healthyone/view/exercise.php?date={$date}");
                } else {
                    if ($_GET['operation'] == 4) {
                        session_start();
                        $username = $_SESSION["username"];