<?php
include("CheckSession.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="馬戲團" />
    <title>馬戲團</title>
    <link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<?php

require_once("class/DBConfig.php");
require_once("class/DBOperation.php");

$db = new DBOperation();

$AName = "";
$AAccount = "";
$APass = "";
$AFlag = "";
$AGroupId = -1;
$AErrTimes = 0;
$AMacAddress = "";
$ALogTime = "";
$id = "";
$ARightLevel = "";
$ARights = "";
$AUpdateFields = "";
$AHourExTimes = 0;
$ADayExTimes = 0;
$ALogTime = "";
$AMacAddressArr = null;
$ALogTimeArr = null;

$db->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
$db->query("SELECT * FROM AdminUser where AAccount = 'admin'");
$row = $db->fetch_row();
$AName = $row[1];
$AAccount = $row[2];
$AFlag = $row[4];
$AGroupId = $row[5];
$AMacAddress = $row[12];
$ARightLevel = $row[13];
$ARights = $row[14];
$AUpdateFields = $row[15];
$AMacAddressArr = explode(",", $AMacAddress);
$AHourExTimes = $row[17];
$ADayExTimes = $row[18];
$ALogTime = $row[19];
$ALogTimeArr = explode(";", $ALogTime);
$db->close_db();

?>
<SCRIPT language="JavaScript">
    function validateForm(objThisUi) {
        if (isNaN(Number(objThisUi.AHourExTimes.value, 10))) {
            alert("請確認時查詢次數上限須為数字!!");
            objThisUi.AHourExTimes.focus();
            return false;
        }

        if (isNaN(Number(objThisUi.ADayExTimes.value, 10))) {
            alert("請確認天查詢次數上限須為数字!!");
            objThisUi.ADayExTimes.focus();
            return false;
        }

        return true;
    }
</SCRIPT>
<body>
    <form method="post" action="LoginQuerySetUpDeal.php" onSubmit="return validateForm(this);">
        <table border="0" cellspacing="0" cellspadding="0" width="90%">
            <tr>
                <td align="left" colspan="2">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td align="left" colspan="2">
                    <span class="t14b"><b>查詢次數限制總設定</b></span>
                </td>
            </tr>
            <tr>
                <td align="left" colspan="2">
                    <table border="3" cellspacing="2" cellspadding="2" width="100%">
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">時查詢次數上限</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AHourExTimes == null) ? "" : $AHourExTimes; ?>" name="AHourExTimes" id="AHourExTimes" size="10" maxlength="5" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                <font color="red">請輸入數字，設定為-1則不判斷查詢次數</font>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">天查詢次數上限</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($ADayExTimes == null) ? "" : $ADayExTimes; ?>" name="ADayExTimes" id="ADayExTimes" size="10" maxlength="5" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                <font color="red">請輸入數字，設定為-1則不判斷查詢次數</font>
                            </td>
                        </tr>
                        <tr>
                            <td align="center" colspan="2">
                                <input type="submit" name="btnSub" id="btnSub" value="變更設定" class="t12" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </form>
</body>

</html>