コード例 #1
0
 function method_deneme()
 {
     if (isset($_REQUEST['next']) || isset($_REQUEST['summary']) || isset($_REQUEST['viewsummary'])) {
         //next question
         $answerStatus = 'unanswered';
         if (time() < strtotime($_SESSION['endtime'])) {
             if (strcmp($answerStatus, "unanswered") != 0) {
                 if (strcmp($answerStatus, "answered") == 0) {
                     $query = "update studentquestion set answered='answered',stdanswer='" . htmlspecialchars($_REQUEST['answer'], ENT_QUOTES) . "' where stdid=" . $_SESSION['stdid'] . " and testid=" . $_SESSION['testid'] . " and qnid=" . $_SESSION['qn'] . ";";
                 } else {
                     $query = "update studentquestion set answered='review',stdanswer='" . htmlspecialchars($_REQUEST['answer'], ENT_QUOTES) . "' where stdid=" . $_SESSION['stdid'] . " and testid=" . $_SESSION['testid'] . " and qnid=" . $_SESSION['qn'] . ";";
                 }
                 if (!executeQuery($query)) {
                     // to do
                     $_GLOBALS['message'] = "Your previous answer is not updated.Please answer once again";
                 }
                 closedb();
             }
         }
         if ((int) $_SESSION['qn'] < (int) $_SESSION['tqn']) {
             $_SESSION['qn'] = $_SESSION['qn'] + 1;
         }
         if ((int) $_SESSION['qn'] == (int) $_SESSION['tqn']) {
             $endOfTest = true;
         }
     } else {
         if (isset($_REQUEST['previous'])) {
             // Perform the changes for current question
             $answerStatus = 'unanswered';
             if (time() < strtotime($_SESSION['endtime'])) {
                 $questionStatus = $this->getQuestionStatus();
                 if (strcmp($answerStatus, "unanswered") != 0) {
                     if (strcmp($answerStatus, "answered") == 0) {
                         $query = "update studentquestion set answered='answered',stdanswer='" . htmlspecialchars($_REQUEST['answer'], ENT_QUOTES) . "' where stdid=" . $_SESSION['stdid'] . " and testid=" . $_SESSION['testid'] . " and qnid=" . $_SESSION['qn'] . ";";
                     } else {
                         $query = "update studentquestion set answered='review',stdanswer='" . htmlspecialchars($_REQUEST['answer'], ENT_QUOTES) . "' where stdid=" . $_SESSION['stdid'] . " and testid=" . $_SESSION['testid'] . " and qnid=" . $_SESSION['qn'] . ";";
                     }
                     if (!executeQuery($query)) {
                         // to do
                         $_GLOBALS['message'] = "Your previous answer is not updated.Please answer once again";
                     }
                     closedb();
                 }
             }
             //previous question
             if ((int) $_SESSION['qn'] > 1) {
                 $_SESSION['qn'] = $_SESSION['qn'] - 1;
             }
         } else {
             if (isset($_REQUEST['fs'])) {
                 //Final Submission
                 header('Location: testack.php');
             }
         }
     }
 }
コード例 #2
0
function delSujetAtelier($id)
{
    $sql = "DELETE FROM `tab_atelier_sujet` WHERE `id_sujet`='" . $id . "'\n\t";
    $db = opendb();
    $result = mysqli_query($db, $sql);
    closedb($db);
    if (FALSE == $result) {
        return FALSE;
    } else {
        return TRUE;
    }
}
コード例 #3
0
ファイル: func.php プロジェクト: alpaca-nemesis/xxl
function conn_db($hostname, $username, $password, $database)
{
    $link = mysql_connect($hostname, $username, $password);
    if (!$link) {
        //echo "Mysql Connect Error".mysql_error();
        return false;
    }
    $ret = mysql_select_db($database);
    if (!$ret) {
        closedb($link);
        return false;
    }
    set_encode($link);
    return $link;
}
コード例 #4
0
ファイル: createXls.php プロジェクト: hew86i/panorama
function createXls()
{
    $page = getQUERY("page");
    $from = getQUERY("from");
    $page1 = $page;
    $req = getQUERY("req");
    $req1 = str_replace("**", "&", $req);
    $url = "";
    $temp = explode("&", $req1);
    $cid = getQUERY("c");
    $uid = getQUERY("u");
    $sd = substr($temp[1], 3);
    $ed = substr($temp[2], 3);
    $lang = substr($temp[0], 2);
    opendb();
    /* format na datum */
    $datetimeformat = dlookup("select datetimeformat from users where id=" . $uid);
    //'Y-m-d h:i:s a'; //
    $datfor = explode(" ", $datetimeformat);
    $dateformat = $datfor[0];
    $timeformat = $datfor[1];
    if ($timeformat == "H:i:s") {
        $e_ = " 23:59";
        $e1_ = "_23:59";
        $s_ = " 00:00";
        $s1_ = "_00:00";
        $tf = " H:i";
    } else {
        $e_ = " 11:59 PM";
        $e1_ = "_11:59_PM";
        $s_ = " 12:00 AM";
        $s1_ = "_12:00_AM";
        $tf = " h:i a";
    }
    $sdG = DateTimeFormat($sd, 'd-m-Y H:i:s');
    $edG = DateTimeFormat($ed, 'd-m-Y H:i:s');
    /* format na datum */
    $nameXls = $page1 . '_' . $cid . '_' . DateTimeFormat($sdG, $dateformat) . $s1_ . '_' . DateTimeFormat($edG, $dateformat) . $e1_ . '.xls';
    $url = $page . "1.php?l=" . $lang . "&u=" . $uid . "&c=" . $cid . "&sd=" . DateTimeFormat($sd, "d-m-Y") . "%2000:00:00&ed=" . DateTimeFormat($ed, "d-m-Y") . "%2023:59:00&from=s";
    closedb();
    if ($from == "s") {
        $handle = fopen('../savePDF/' . $nameXls, 'w+') or die('Cannot open file:  ' . $nameXls);
        $data = file_get_contents("http://panorama.gps.mk/settings/" . $url);
        fwrite($handle, $data);
        fclose($handle);
        echo $nameXls;
    }
}
コード例 #5
0
ファイル: MessageReportPDF.php プロジェクト: hew86i/panorama
        ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="text2" style="font-style:italic; color:#153B75; font-size:12px"><?php 
        echo dic_("Reports.NoDataDay");
        ?>
</span></strong></td>
                    	</tr>
                    	<?php 
    }
    ?>

          </table>
			
			<?php 
    $_datumCnt = addToDate($_datumCnt, 1, "days");
}
closedb();
?>
          <br /><br />
          </div><br>
        <div id="footer-rights-new" class="textFooter" style="padding:10px 10px 10px 10px">
			<?php 
echo $CopyrightString;
?>
&nbsp;|&nbsp;<?php 
echo session("company");
?>
&nbsp;|&nbsp;<?php 
echo session("user_fullname");
?>
&nbsp;|&nbsp;<?php 
echo $CreationDate;
コード例 #6
0
ファイル: lookback.php プロジェクト: alpaca-nemesis/xxl
        </tr>
<?php 
while ($row = mysql_fetch_array($ret)) {
    $i = $i + 1;
    if ($row['type'] == 1) {
        $type = "judgement";
    } elseif ($row['type'] == 2) {
        $type = "fill";
    } else {
        $type = "choice";
    }
    $query1 = "SELECT * FROM " . $type . "_" . $row['chapter'] . " WHERE " . $type . "_no=" . $row['no'];
    $ret1 = mysql_query($query1, $link);
    if (!$ret1) {
        echo "query ERROR";
        closedb($link);
        exit;
    }
    $row1 = mysql_fetch_row($ret1);
    ?>
    
	
	<tr>
    <td align="center">
    <?php 
    echo $row1[1];
    ?>
    </td>
	<td align="center" width="600px">
    <?php 
    echo $row1[2];
コード例 #7
0
#!/usr/bin/php -q
<?php 
////////////////////////////////////////////////////////////////////////////
// $Id$
//
// Description: statistics cleanup
//
////////////////////////////////////////////////////////////////////////////
include "cleanup-functions.php";
include "cleanup-config.php";
// ************* PRELIMINARY TASKS, DATA INIT *************
set_time_limit(0);
// get for which revision we generate stats
if ($argv[1] == "") {
    $rev = "HEAD";
} else {
    $rev = $argv[1];
}
// open database connection
$dbh = initdb($sql_host, $sql_user, $sql_pass, $sql_db);
debug(10, "cleanup statistics");
$res = @mysql_query("DELETE FROM essential WHERE rev='{$rev}' AND " . "sdate < DATE_SUB(NOW(),INTERVAL '60' DAY)", $dbh);
if (!$res) {
    send_err("SQL error: delete by sdate for {$rev} branch.");
    die;
}
$deleted = @mysql_affected_rows($dbh);
debug(10, "deleted {$deleted} records for {$rev} branch");
closedb($dbh);
// send_ok("Deleted $deleted records for $rev branch.");
コード例 #8
0
ファイル: Fun.php プロジェクト: harshaccent/kurry
 public static function redirect($url, $cnd = true)
 {
     if ($cnd) {
         closedb();
         header("Location: " . $url);
         exit(0);
     }
 }
コード例 #9
0
ファイル: alerts.php プロジェクト: hew86i/panorama
       if(radios[i].checked === true) {
           return  radios[i].value;
       }
     }
 }

$(document).ready(function(){

	$('.del-btn').button({ icons: { primary: "ui-icon-trash"} });
	$('.edit-btn').button({ icons: { primary: "ui-icon-pencil"} });

   	$('#add5').button({ icons: { primary: "ui-icon-plusthick"} });
   	$('#play').button({ icons: { primary: "ui-icon-play"} });
    $('#pause').button({ icons: { primary: "ui-icon-pause"} });
    $('#poglasno').button({ icons: { primary: "ui-icon-plus"} });
    $('#potivko').button({ icons: { primary: "ui-icon-minus"} });
    $('#gfAvail').buttonset();

    $('#main_table tr td:nth-child(3) div').hide();

   	setDates();
    top.HideWait();

});

</script>

</html>

<?php closedb(); ?>
コード例 #10
0
function enterConnexionstatus($iduser, $date, $type, $macadress, $navig, $exploitation)
{
    $sql = "INSERT INTO `tab_connexion`(`id_connexion`, `id_user`, `date_cx`, `type_cx`, `macasdress_cx`, `navigateur_cx`, `system_cx`) \n\tVALUES ('','" . $iduser . "','" . $date . "','" . $type . "','" . $macadress . "','" . $navig . "','" . $exploitation . "')";
    $db = opendb();
    $result = mysqli_query($db, $sql);
    closedb($db);
    if ($result == TRUE) {
        return TRUE;
    } else {
        return FALSE;
    }
}
コード例 #11
0
function eachResult($iID)
{
    //显示基本信息信息
    echo '<font style="color:red;font-weight:bold;">一:基本信息:</font><br/><br/>';
    $query = "select formid from Basic" . $iID . " where formid=1;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question1 = array('姓名', '年龄(周岁)', '性别', '受教育程度', '年级', '民族', '宿舍号', '电话', '身高(cm)', '体重(kg)', 'Email', '身份证号', '个人编号', '出生地', '大学前长居住地', '睡眠时间是否规律', '每日平均睡眠时间(小时)', '每日平均睡眠时间(分钟)', '是否有午休习惯', '一周几次', '一次多长时间', '过去一年是否从事倒班工作', '几次', '过去三个月是否进行跨越1个时区以上的旅行', '如有,请注明时间地点', '有无睡眠相关疾病', '如有,请说疾病名称和患病时间', '平均每周饮酒', '平均每周饮咖啡', '您的月经周期是否规律', '您的月经周期', '平均每次月经持续时间', '初潮年龄');
        for ($i = 1; $i <= 33; $i++) {
            $query = "select * from Basic" . $iID . " where formid=1 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question1[$i - 1] . '</font>:' . $r[3] . '<br/>';
            }
        }
        //BMI指数计算
        echo '<font style="color:#0000FF;font-weight:bold;">BMI指数:</font>';
        $query = "call BMI('Basic" . $iID . "',@output);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        $r = mysql_fetch_row($result);
        echo $r[0];
        mysql_free_result($result);
    }
    closedb();
    //显示表二的信息
    echo '<br/><br/><font style="color:red;font-weight:bold;">二:睡眠研究问卷调查:</font>';
    echo '<br/><br/><font style="color:#E99324;font-weight:bold;">表二:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
    $query = "select formid from PartTwo" . $iID . " where formid=2;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question2 = array('1.', '2.', '3.', '4.', '5(1).', '5(2).', '5(3).', '5(4).', '5(5).', '5(6).', '5(7).', '5(8).', '5(9).', '5(10).', '5(10)', '6.', '7', '8', '9', '10', '10(1).', '10(2).', '10(3).', '10(4).', '10(5).', '10(5)');
        for ($i = 1; $i <= 26; $i++) {
            $query = "select * from PartTwo" . $iID . " where formid=2 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question2[$i - 1] . '</font>&nbsp' . $r[3] . '&nbsp&nbsp';
            }
        }
        //显示表二计算结果
        echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
        $query = "call score2('PartTwo" . $iID . "',@A,@B,@c,@D,@E,@F,@G,@score);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">睡眠质量(A):</font>' . $r[0] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">入睡时间(B):</font>' . $r[1] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">睡眠时间(C):</font>' . $r[2] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">睡眠效率(D):</font>' . $r[3] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">睡眠障碍(E):</font>' . $r[4] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">催眠药物(F):</font>' . $r[5] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">日间功能障碍(G):</font>' . $r[6] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">PSQI总分:</font>' . $r[7] . '<br/><br/>';
        }
        mysql_free_result($result);
    }
    closedb();
    //显示表三的信息
    echo '<font style="color:#E99324;font-weight:bold;">表三:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
    $query = "select formid from PartTwo" . $iID . " where formid=3;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question3 = array('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8');
        for ($i = 1; $i <= 8; $i++) {
            $query = "select * from PartTwo" . $iID . " where formid=3 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question3[$i - 1] . '</font>&nbsp' . $r[3] . '&nbsp&nbsp';
            }
        }
        //显示表三计算结果
        echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
        $query = "call score('PartTwo" . $iID . "',3,@score);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">SCORE:</font>' . $r[0] . '&nbsp&nbsp&nbsp';
            if ($r[0] > 6 && $r[0] < 12) {
                echo '瞌睡';
            } elseif ($r[0] > 11 && $r[0] < 17) {
                echo '过度瞌睡';
            } elseif ($r[0] > 16) {
                echo '有危险性的瞌睡';
            }
        }
        mysql_free_result($result);
    }
    closedb();
    //显示表四的信息
    echo '<br/><br/><font style="color:#E99324;font-weight:bold;">表四:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
    $query = "select formid from PartTwo" . $iID . " where formid=4;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question4 = array('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19');
        for ($i = 1; $i <= 19; $i++) {
            $query = "select * from PartTwo" . $iID . " where formid=4 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question4[$i - 1] . '</font>&nbsp' . $r[3] . '&nbsp&nbsp';
            }
        }
        //显示计算结果
        echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
        $query = "call score('PartTwo" . $iID . "',4,@score);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">SCORE:</font>' . $r[0] . '&nbsp&nbsp&nbsp';
            if ($r[0] > 15 && $r[0] < 43) {
                echo '绝对夜晚型';
            } elseif ($r[0] > 42 && $r[0] < 50) {
                echo '中度夜晚型';
            } elseif ($r[0] > 49 && $r[0] < 63) {
                echo '中间型';
            } elseif ($r[0] > 62 && $r[0] < 70) {
                echo '中度清晨型';
            } elseif ($r[0] > 69 && $r[0] < 87) {
                echo '绝对清晨型';
            }
        }
        mysql_free_result($result);
    }
    closedb();
    //显示表五的信息
    echo '<br/><br/><font style="color:#E99324;font-weight:bold;">表五:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
    $query = "select formid from PartTwo" . $iID . " where formid=5;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question5 = array('1(1).', '1(2).', '2.', '3.', '4(1).', '4(2).', '5.', '6(1).', '6(2).', '7(1).', '7(2).', '8(1).', '8(2).', '1.', '2(1).', '2(2).', '3.', '4.', '5.', '6(1).', '6(2).', '7.', '8(1).', '8(2).', '9(1).', '9(2).', '10(1)', '10(2)', '1.', '2.', '3.', '4.', '5(1).', '5(2).', '5(3).', '5(4).');
        for ($i = 1; $i <= 36; $i++) {
            $query = "select * from PartTwo" . $iID . " where formid=5 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question5[$i - 1] . '</font>&nbsp' . $r[3] . '&nbsp&nbsp';
                if ($i == 4) {
                    $n = $r[3];
                }
            }
        }
        //显示计算结果
        echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
        $query = "call score5('PartTwo" . $iID . "',@A,@B,@C,@D,@E,@F,@G,@H,@I,@J,@k,@l,@m);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">工作日睡觉时间:</font>' . $r[0] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">工作日睡醒时间:</font>' . $r[1] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">工作日完全清醒时间:</font>' . $r[2] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">工作日中间时间:</font>' . $r[3] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">工作日持续时间:</font>' . $r[4] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">休息日睡觉时间:</font>' . $r[5] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">休息日睡醒时间:</font>' . $r[6] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">休息日完全清醒时间:</font>' . $r[7] . '&nbsp&nbsp&nbsp&nbsp&nbsp<br/><font style="color:#0000FF"> 休息日中间时间:</font>' . $r[8] . '&nbsp&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">休息日持续时间:</font>' . $r[9] . '&nbsp&nbsp&nbsp&nbsp<font style="color:#0000FF">户外时间:</font>' . $r[12] . '&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp';
            echo '<font style="color:#0000FF">类型:</font>';
            if ($n == "A") {
                if ($r[10] < 121) {
                    echo 'extreme early';
                } elseif ($r[10] > 120 && $r[10] < 181) {
                    echo 'moderate early';
                } elseif ($r[10] > 180 && $r[10] < 241) {
                    echo 'slight early';
                } elseif ($r[10] > 240 && $r[10] < 301) {
                    echo 'normal';
                } elseif ($r[10] > 300 && $r[10] < 361) {
                    echo 'slight late';
                } elseif ($r[10] > 360 && $r[10] < 421) {
                    echo 'moderate late';
                } elseif ($r[10] > 420) {
                    echo 'extreme late';
                }
            } elseif ($n == "B") {
                if ($r[10] < 121) {
                    echo 'extreme early';
                } elseif ($r[10] > 120 && $r[10] < 181) {
                    echo 'moderate early';
                } elseif ($r[10] > 180 && $r[10] < 241) {
                    echo 'slight early';
                } elseif ($r[10] > 240 && $r[10] < 301) {
                    echo 'normal';
                } elseif ($r[10] > 300 && $r[10] < 361) {
                    echo 'slight late';
                } elseif ($r[10] > 360 && $r[10] < 421) {
                    echo 'moderate late';
                } elseif ($r[10] > 420) {
                    echo 'extreme late';
                }
                echo "(休息日)";
                if ($r[11] < 121) {
                    echo 'extreme early';
                } elseif ($r[11] > 120 && $r[11] < 181) {
                    echo 'moderate early';
                } elseif ($r[11] > 180 && $r[11] < 241) {
                    echo 'slight early';
                } elseif ($r[11] > 240 && $r[11] < 301) {
                    echo 'normal';
                } elseif ($r[11] > 300 && $r[11] < 361) {
                    echo 'slight late';
                } elseif ($r[11] > 360 && $r[11] < 421) {
                    echo 'moderate late';
                } elseif ($r[11] > 420) {
                    echo 'extreme late';
                }
                echo "(工作日)";
            }
        }
        mysql_free_result($result);
    }
    closedb();
    //显示表六的信息
    echo '<br/><br/><font style="color:#E99324;font-weight:bold;">表六:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
    $query = "select formid from PartTwo" . $iID . " where formid=6;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question6 = array('1(1).', '1(2).', '1(3).', '2.', '3.', '4.', '5.');
        for ($i = 1; $i <= 7; $i++) {
            $query = "select * from PartTwo" . $iID . " where formid=6 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question6[$i - 1] . '</font>&nbsp' . $r[3] . '&nbsp&nbsp';
            }
        }
        //显示计算结果
        echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
        $query = "call score('PartTwo" . $iID . "',6,@score);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">SCORE:</font>' . $r[0] . '&nbsp&nbsp&nbsp';
            if ($r[0] < 8) {
                echo '没有临床上显著的失眠症';
            } elseif ($r[0] > 7 && $r[0] < 15) {
                echo '阈下失眠症';
            } elseif ($r[0] > 14 && $r[0] < 22) {
                echo '临床失眠症(中重度)';
            } elseif ($r[0] > 62 && $r[0] < 70) {
                echo '中度清晨型';
            } elseif ($r[0] > 21 && $r[0] < 29) {
                echo '临床失眠症(重度)';
            }
        }
        mysql_free_result($result);
    }
    closedb();
    //显示表七的信息
    echo '<br/><br/><font style="color:#E99324;font-weight:bold;">表七:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
    $query = "select formid from PartTwo" . $iID . " where formid=7;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question7 = array('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8.', '9.', '10.', '11.', '12.', '13.', '14.', '15.', '16.', '17.', '18.', '19.', '20.', '21.');
        for ($i = 1; $i <= 21; $i++) {
            $query = "select * from PartTwo" . $iID . " where formid=7 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question7[$i - 1] . '</font>&nbsp' . $r[3] . '&nbsp&nbsp';
            }
        }
        //显示计算结果
        echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
        $query = "call score('PartTwo" . $iID . "',7,@score);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">SCORE:</font>' . $r[0] . '&nbsp&nbsp&nbsp';
            if ($r[0] < 5) {
                echo '无抑郁';
            } elseif ($r[0] > 4 && $r[0] < 8) {
                echo '轻度抑郁';
            } elseif ($r[0] > 7 && $r[0] < 16) {
                echo '中度抑郁';
            } elseif ($r[0] > 15) {
                echo '重度抑郁';
            }
        }
        mysql_free_result($result);
    }
    closedb();
    //显示表八的信息
    echo '<br/><br/><font style="color:#E99324;font-weight:bold;">表八:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
    $query = "select formid from PartTwo" . $iID . " where formid=8;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question8 = array('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8.', '9.', '10.', '11.', '12.', '13.', '14.', '15.', '16.', '17.', '18.', '19.', '20.', '21.');
        for ($i = 1; $i <= 21; $i++) {
            $query = "select * from PartTwo" . $iID . " where formid=8 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question8[$i - 1] . '</font>&nbsp' . $r[3] . '&nbsp&nbsp';
            }
        }
        //显示计算结果
        echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
        $query = "call score('PartTwo" . $iID . "',8,@score);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">SCORE:</font>' . round(1.19 * $r[0]) . '&nbsp&nbsp&nbsp';
            if ($r[0] > 44) {
                echo '焦虑阳性';
            }
        }
        mysql_free_result($result);
    }
    closedb();
    //显示表九的信息
    echo '<br/><br/><font style="color:#E99324;font-weight:bold;">表九:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
    $query = "select formid from PartTwo" . $iID . " where formid=9;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question9 = array('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8.', '9.', '10.', '11.', '12.', '13.', '14.', '15.', '16.', '17.', '18.', '19.', '20.');
        for ($i = 1; $i <= 20; $i++) {
            $query = "select * from PartTwo" . $iID . " where formid=9 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question9[$i - 1] . '</font>&nbsp' . $r[3] . '&nbsp&nbsp';
            }
        }
        //显示计算结果
        echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
        $query = "call score('PartTwo" . $iID . "',9,@score);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">SCORE:</font>' . $r[0] . '&nbsp&nbsp&nbsp';
            if ($r[0] < 8) {
                echo '没有临床上显著的失眠症';
            } elseif ($r[0] > 7 && $r[0] < 15) {
                echo '阈下失眠症';
            } elseif ($r[0] > 14 && $r[0] < 22) {
                echo '临床失眠症(中重度)';
            } elseif ($r[0] > 62 && $r[0] < 70) {
                echo '中度清晨型';
            } elseif ($r[0] > 21 && $r[0] < 29) {
                echo '临床失眠症(重度)';
            }
        }
        mysql_free_result($result);
    }
    closedb();
    //显示表十的信息
    echo '<br/><br/><font style="color:#E99324;font-weight:bold;">表十:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
    $query = "select formid from PartTwo" . $iID . " where formid=10;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question10 = array('1.', '2.', '3(1).', '3(2).', '3(3).', '3(4).', '3(5).', '3(6).', '3(7).', '3(8).', '3(9).', '3(10).', '4(1).', '4(2).', '4(3).', '4(4).', '5(1).', '5(2).', '5(3).', '6.', '7.', '8.', '9(1).', '9(2).', '9(3).', '9(4).', '9(5).', '9(6).', '9(7).', '9(8).', '9(9).', '9(10).', '10(1).', '10(2).', '10(3).', '10(4).');
        for ($i = 1; $i <= 36; $i++) {
            $query = "select * from PartTwo" . $iID . " where formid=10 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question10[$i - 1] . '</font>&nbsp' . $r[3] . '&nbsp&nbsp';
            }
        }
        //显示计算结果
        echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
        $query = "call score10PF('PartTwo" . $iID . "',@PF);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">PF:</font>' . $r[0] . '&nbsp&nbsp&nbsp&nbsp&nbsp';
        }
        closedb();
        $query = "call score10RP('PartTwo" . $iID . "',@RP);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">RP:</font>' . $r[0] . '&nbsp&nbsp&nbsp&nbsp&nbsp';
        }
        closedb();
        $query = "call score10BP('PartTwo" . $iID . "',@BP);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">BP:</font>' . $r[0] . '&nbsp&nbsp&nbsp&nbsp&nbsp';
        }
        closedb();
        $query = "call score10GH('PartTwo" . $iID . "',@GH);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">GH:</font>' . $r[0] . '&nbsp&nbsp&nbsp&nbsp&nbsp';
        }
        closedb();
        $query = "call score10VT('PartTwo" . $iID . "',@VT);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">VT:</font>' . $r[0] . '&nbsp&nbsp&nbsp&nbsp&nbsp';
        }
        closedb();
        $query = "call score10SF('PartTwo" . $iID . "',@SF);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">SF:</font>' . $r[0] . '&nbsp&nbsp&nbsp&nbsp&nbsp';
        }
        closedb();
        $query = "call score10RE('PartTwo" . $iID . "',@RE);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">RE:</font>' . $r[0] . '&nbsp&nbsp&nbsp&nbsp&nbsp';
        }
        closedb();
        $query = "call score10MH('PartTwo" . $iID . "',@MH);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">MH:</font>' . $r[0] . '&nbsp&nbsp&nbsp&nbsp&nbsp';
        }
        mysql_free_result($result);
    }
    closedb();
    //显示表十一的信息
    echo '<br/><br/><font style="color:#E99324;font-weight:bold;">表十一:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
    $query = "select formid from PartTwo" . $iID . " where formid=11;";
    $result = executeQuery($query);
    if (!$result) {
        die(mysql_error());
    }
    if (mysql_fetch_row($result)) {
        //显示信息
        $question11 = array('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8.', '9.', '10.', '11.', '12.', '13.');
        for ($i = 1; $i <= 13; $i++) {
            $query = "select * from PartTwo" . $iID . " where formid=11 and questionid=" . $i . ";";
            $result = executeQuery($query);
            if (!$result) {
                die(mysql_error());
            }
            while ($r = mysql_fetch_row($result)) {
                if ($r[3] == '') {
                    $r[3] = '此处没有填写';
                }
                echo '<font style="color:#0000FF">' . $question11[$i - 1] . '</font>&nbsp' . $r[3] . '&nbsp&nbsp';
            }
        }
        //显示计算结果
        echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
        $query = "call score('PartTwo" . $_REQUEST[ID] . "',11,@score);";
        $result = executeQuery($query);
        if (!$result) {
            die(mysql_error());
        }
        while ($r = mysql_fetch_row($result)) {
            echo '<font style="color:#0000FF">SCORE:</font>' . $r[0] . '&nbsp&nbsp&nbsp';
            if ($r[0] < 23) {
                echo '“夜晚”型';
            } elseif ($r[0] > 7 && $r[0] < 15) {
                echo '阈下失眠症';
            } elseif ($r[0] > 23 && $r[0] < 43) {
                echo '中间型';
            } elseif ($r[0] > 43) {
                echo '“清晨”型';
            }
        }
        mysql_free_result($result);
    }
    closedb();
}
コード例 #12
0
function getResaBy2dates($id, $date1, $date2)
{
    $sql = "SELECT `id_resa`,`dateresa_resa`,`debut_resa`,`duree_resa`,nom_computer FROM tab_resa \n          INNER JOIN tab_computer ON id_computer=id_computer_resa\n          WHERE `id_user_resa`=" . $id . " \n\t\tAND `dateresa_resa` BETWEEN '" . $date1 . "' AND '" . $date2 . "'\n\t\tORDER BY `dateresa_resa` DESC , `debut_resa` DESC";
    $db = opendb();
    $result = mysqli_query($db, $sql);
    closedb($db);
    if (FALSE == mysqli_num_rows($result)) {
        return FALSE;
    } else {
        return $result;
    }
}
コード例 #13
0
function insertCapt()
{
    $sql = "INSERT INTO `tab_captcha`(`id_captcha`, `capt_activation`, `capt_code`) VALUES (1,'N','') ;";
    $db = opendb();
    $result = mysqli_query($db, $sql);
    closedb($db);
    if (FALSE == $result) {
        $row = "echec";
    } else {
        $row = "OK";
    }
    return $row;
}
コード例 #14
0
$sql = "INSERT INTO " . $table;
$fields = array();
$values = array();
foreach ($_GET as $key => $val) {
    $column = $key;
    echo "<br>{$key} = {$val}<br>";
    $fields[] = "`{$key}`";
    $values[] = "'" . $val . "'";
    $mysqli = connectdb($dbhost, $dbuser, $dbpassword, $db);
    // connect to database
    createdbcol($mysqli, $column, $table);
    // create columns
}
senddbdata($sql, $mysqli, $fields, $values);
// send data
closedb($mysqli);
// close database
// connect to database
function connectdb($dbhost, $dbuser, $dbpassword, $db)
{
    $mysqli = new mysqli("{$dbhost}", "{$dbuser}", "{$dbpassword}", "{$db}");
    /* check connection */
    if ($mysqli->connect_errno) {
        printf("Connect failed: %s\n", $mysqli->connect_error);
        exit;
    }
    return $mysqli;
}
// create column
function createdbcol($mysqli, $column, $table)
{
コード例 #15
0
function getCyberSpec($epn)
{
    $sql = "SELECT * FROM `tab_espace` WHERE `id_espace`='" . $epn . "' ";
    $db = opendb();
    $result = mysqli_query($db, $sql);
    closedb($db);
    if (FALSE == $result) {
        return FALSE;
    } else {
        return mysqli_fetch_array($result);
    }
}