Example #1
0
<body>
  
<?php 
// if(!(is_array($_GET)&&count($_GET)>0&&isset($_GET["isLoad"]))){
//     header("Location: http://localhost/healthyone/controller/healthProcess.php?operation=4");
// }
session_start();
$username = $_SESSION["username"];
$height = 0;
$weight = 0;
$bmi = 0;
$perfectWeight = 0;
$condition = "";
require '../model/healthService.class.php';
$res = HealthService::findHW($username);
if ($item = $res->fetchArray(SQLITE3_ASSOC)) {
    $height = $item['HEIGHT'];
    $weight = $item['WEIGHT'];
}
$perfectWeight = round(22.0 * $height * $height / 10000, 1);
if ($height > 0) {
    $bmi = round($weight / ($height * $height) * 10000.0, 1);
}
$weightChange = HealthService::weightChange($username);
if ($bmi != 0) {
    if ($bmi < 18.5) {
        $condition = "(偏轻)";
    } elseif ($bmi >= 18.5 && $bmi < 24) {
        $condition = "(健康)";
    } elseif ($bmi >= 24 && $bmi < 28) {