<?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";

$action = $_GET["action"];

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

$db = new DBOperation();

if ($action == "Update") {
    $id = $_GET["id"];
    $db->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
    $db->query("SELECT * FROM AdminUser where AId = '" . $db->mysql_real_escape_string($id) . "'");
    $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();
}

$db->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
$db->query("select GId,GName from GroupRights");
?>
<SCRIPT language="JavaScript">
    var showFlag = {};

    function show(o) {
        showFlag[o.name] = o.value;
        if (showFlag.ARightLevel == "2") {
            document.getElementById("a3").style.display = "";
        } else {
            document.getElementById("a3").style.display = "none";
        }
    }

    function validateForm(objThisUi) {
        if (objThisUi.AName.value.length == 0) {
            alert("請輸入姓名!!");
            objThisUi.AName.focus();
            return false;
        }

        if (objThisUi.AAccount.value.length == 0) {
            alert("請輸入帳號!!");
            objThisUi.AAccount.focus();
            return false;
        }
        if ("<?php echo $action ?>" == "Insert") {
            if (objThisUi.APass.value.length == 0) {
                alert("請輸入密碼!!");
                objThisUi.APass.focus();
                return false;
            }

            if (objThisUi.APassConfirm.value.length == 0) {
                alert("請輸入確認密碼!!");
                objThisUi.APassConfirm.focus();
                return false;
            }

            if (objThisUi.APass.value != objThisUi.APassConfirm.value) {
                alert("請確認密碼和確認密碼相同!!");
                objThisUi.APassConfirm.focus();
                return false;
            }
        } else {
            if (objThisUi.APass.value.length != 0) {
                if (objThisUi.APass.value != objThisUi.APassConfirm.value) {
                    alert("請確認密碼和確認密碼相同!!");
                    objThisUi.APassConfirm.focus();
                    return false;
                }
            }
        }

        if (objThisUi.AMacAddress0.value.length == 0) {
            alert("請至少輸入一個登入的Mac Address!!");
            objThisUi.AMacAddress0.focus();
            return false;
        }

        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;
        }

        if (objThisUi.ALogTime0_1_1.value.length == 0 || objThisUi.ALogTime0_1_2.value.length == 0 ||
            objThisUi.ALogTime0_2_1.value.length == 0 || objThisUi.ALogTime0_2_2.value.length == 0) {
            alert("請至少輸入一個登入的時段!!");
            objThisUi.ALogTime0_1_1.focus();
            return false;
        }

        if (isNaN(Number(objThisUi.ALogTime0_1_1.value, 10)) ||
            isNaN(Number(objThisUi.ALogTime0_1_2.value, 10)) ||
            isNaN(Number(objThisUi.ALogTime0_2_1.value, 10)) ||
            isNaN(Number(objThisUi.ALogTime0_2_2.value, 10))) {
            alert("請確認可登入的時段1的時段資料須為数字!!");
            objThisUi.ALogTime0_1_1.focus();
            return false;
        }

        if (objThisUi.ALogTime1_1_1.value.length > 0 ||
            objThisUi.ALogTime1_1_2.value.length > 0 ||
            objThisUi.ALogTime1_2_1.value.length > 0 ||
            objThisUi.ALogTime1_2_2.value.length > 0 ) {

            if ((objThisUi.ALogTime1_1_1.value.length > 0 && isNaN(Number(objThisUi.ALogTime1_1_1.value, 10))) ||
                (objThisUi.ALogTime1_1_2.value.length > 0 && isNaN(Number(objThisUi.ALogTime1_1_2.value, 10))) ||
                (objThisUi.ALogTime1_2_1.value.length > 0 && isNaN(Number(objThisUi.ALogTime1_2_1.value, 10))) ||
                (objThisUi.ALogTime1_2_2.value.length > 0 && isNaN(Number(objThisUi.ALogTime1_2_2.value, 10)))) {
                alert("可登入的時段2 請輸入完全且正確的時段資料!!");
                objThisUi.ALogTime1_1_1.focus();
                return false;
            }
        }

        if (objThisUi.ALogTime2_1_1.value.length > 0 ||
            objThisUi.ALogTime2_1_2.value.length > 0 ||
            objThisUi.ALogTime2_2_1.value.length > 0 ||
            objThisUi.ALogTime2_2_2.value.length > 0 ) {

            if ((objThisUi.ALogTime2_1_1.value.length > 0 && isNaN(Number(objThisUi.ALogTime2_1_1.value, 10))) ||
                (objThisUi.ALogTime2_1_2.value.length > 0 && isNaN(Number(objThisUi.ALogTime2_1_2.value, 10))) ||
                (objThisUi.ALogTime2_2_1.value.length > 0 && isNaN(Number(objThisUi.ALogTime2_2_1.value, 10))) ||
                (objThisUi.ALogTime2_2_2.value.length > 0 && isNaN(Number(objThisUi.ALogTime2_2_2.value, 10)))) {
                alert("可登入的時段3 請輸入完全且正確的時段資料!!");
                objThisUi.ALogTime2_1_1.focus();
                return false;
            }
        }
        return true;
    }
</SCRIPT>

<body>
    <form name="AdminUserForm" method="post" action="AdminUserUpdateDeal.php" id="AdminUserForm" onSubmit="return validateForm(this);">
        <input type="hidden" name="action" id="action" value="<?php echo $action ?>" />
        <input type="hidden" name="id" id="id" value="<?php echo $id ?>" />
        <table border="0" cellspacing="0" cellspadding="0" width="90%">
            <!--
<tr>
<td align="center" colspan="2">
<span class="title"><b>使用者管理</b></span>
</td>
</tr>
-->
            <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 $AName ?>" name="AName" id="AName" size="50" maxlength="50" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">帳號</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo $AAccount ?>" name="AAccount" id="AAccount" size="20" maxlength="20" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">密碼</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="password" name="APass" id="APass" size="20" maxlength="20" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">確認密碼</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="password" name="APassConfirm" id="APassConfirm" size="20" maxlength="20" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <?php
                        if ($_SESSION['rightLevel'] == "0") {
                        ?>
                            <tr>
                                <td align="left">
                                    <span class="t12">人員角色</span>
                                </td>
                                <td>
                                    <input type="radio" onclick="show(this)" value="0" <?php if ($ARightLevel == "0") {
                                                                                            echo "checked";
                                                                                        }
                                                                                        ?> name="ARightLevel">
                                    <span class="t12">最高管理者</span>
                                    <br>
                                    <input type="radio" onclick="show(this)" value="1" <?php if ($ARightLevel == "1") {
                                                                                            echo "checked";
                                                                                        } elseif ($ARightLevel == null) {
                                                                                            echo "checked";
                                                                                        }
                                                                                        ?> name="ARightLevel">
                                    <span class="t12">群主</span>
                                    <br>
                                    <input type="radio" onclick="show(this)" value="2" <?php if ($ARightLevel == "2") {
                                                                                            echo "checked";
                                                                                        }
                                                                                        ?> name="ARightLevel">
                                    <span class="t12">人員</span>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <span class="t12">所屬群組</span>
                                </td>
                                <td align="left">
                                    <span class="t12">
                                        <Select name="AGroupId">
                                            <?php
                                            $i = 0;
                                            while ($myrow = $db->fetch_array()) {
                                                if ($myrow['GId'] == 1 && $_SESSION['username'] != "admin") {
                                                    continue;
                                                }

                                                $i++;
                                                echo $myrow['GId'];
                                            ?>
                                                <Option Value="<?php echo $myrow['GId'] ?>" <?php if ($AGroupId == $myrow['GId']) {
                                                                                                echo "selected";
                                                                                            } elseif ($AGroupId == -1 && $i == 1) {
                                                                                                echo "selected";
                                                                                            }
                                                                                            ?>><?php echo $myrow['GName'] ?></Option>
                                            <?php
                                            }
                                            $db->close_db();
                                            ?>
                                        </Select>
                                    </span>
                                </td>
                            </tr>
                        <?php
                        } elseif ($_SESSION['rightLevel'] == "1") {
                        ?>
                            <tr>
                                <td align="left">
                                    <span class="t12">人員角色</span>
                                </td>
                                <td>
                                    <input type="hidden" name="ARightLevel" id="ARightLevel" value="2" />
                                    <span class="t12">人員</span>
                                </td>
                            </tr>
                            <tr>
                                <td align="left">
                                    <span class="t12">所屬群組</span>
                                </td>
                                <td>
                                    <input type="hidden" name="AGroupId" id="AGroupId" value="<?php echo $_SESSION['groupId']; ?>" />
                                    <span class="t12"><?php echo $_SESSION['groupName']; ?></span>
                                </td>
                            </tr>
                        <?php
                        }
                        ?>
                        <tr>
                            <td colspan="2" width="100%">
                                <div id="a3" name="a3" style="display:none;">
                                    <table border="1" cellspacing="0" cellspadding="0" width="100%">
                                        <tr>
                                            <td align="left" width="15%">
                                                <span class="t12">功能</span>
                                            </td>
                                            <td>
                                                <input type="checkbox" name="chkInsert" id="chkInsert" value="I" <?php if (str_indexof($ARights, "I") >= 0) {
                                                                                                                        echo "checked";
                                                                                                                    }
                                                                                                                    ?>>
                                                <span class="t12">新增</span>
                                                &nbsp;
                                                <input type="checkbox" name="chkDel" id="chkDel" value="D" <?php if (str_indexof($ARights, "D") >= 0) {
                                                                                                                echo "checked";
                                                                                                            }
                                                                                                            ?>>
                                                <span class="t12">刪除</span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="left">
                                                <span class="t12">修改</span>
                                            </td>
                                            <td>
                                                <input type="checkbox" name="chkUpdateTel" id="chkUpdateTel" value="CTel" <?php if (str_indexof($AUpdateFields, "CTel") >= 0) {
                                                                                                                                echo "checked";
                                                                                                                            }
                                                                                                                            ?>>
                                                <span class="t12">電話</span>
                                                &nbsp;
                                                <input type="checkbox" name="chkUpdateArea" id="chkUpdateArea" value="CArea" <?php if (str_indexof($AUpdateFields, "CArea") >= 0) {
                                                                                                                                    echo "checked";
                                                                                                                                }
                                                                                                                                ?>>
                                                <span class="t12">地區</span>
                                                &nbsp;
                                                <input type="checkbox" name="chkUpdateSource" id="chkUpdateSource" value="CSource" <?php if (str_indexof($AUpdateFields, "CSource") >= 0) {
                                                                                                                                        echo "checked";
                                                                                                                                    }
                                                                                                                                    ?>>
                                                <span class="t12">來源</span>
                                                &nbsp;
                                                <input type="checkbox" name="chkUpdateNickname" id="chkUpdateNickname" value="CNickname" <?php if (str_indexof($AUpdateFields, "CNickname") >= 0) {
                                                                                                                                                echo "checked";
                                                                                                                                            }
                                                                                                                                            ?>>
                                                <span class="t12">暱稱/其他</span>
                                                &nbsp;
                                                <input type="checkbox" name="chkUpdateMemo" id="chkUpdateMemo" value="CMemo" <?php if (str_indexof($AUpdateFields, "CMemo") >= 0) {
                                                                                                                                    echo "checked";
                                                                                                                                }
                                                                                                                                ?>>
                                                <span class="t12">喜好/備註</span>
                                                &nbsp;
                                                <input type="checkbox" name="chkUpdateMissContent" id="chkUpdateMissContent" value="CMissContent" <?php if (str_indexof($AUpdateFields, "CMissContent") >= 0) {
                                                                                                                                                        echo "checked";
                                                                                                                                                    }
                                                                                                                                                    ?>>
                                                <span class="t12">消費內容</span>
                                                &nbsp;
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">登入的Mac Address1</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AMacAddressArr == null || $AMacAddressArr[0] == null) ? "" : $AMacAddressArr[0]; ?>" name="AMacAddress0" id="AMacAddress0" size="70" maxlength="100" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">登入的Mac Address2</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AMacAddressArr == null || $AMacAddressArr[1] == null) ? "" : $AMacAddressArr[1]; ?>" name="AMacAddress1" id="AMacAddress1" size="70" maxlength="100" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">登入的Mac Address3</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AMacAddressArr == null || $AMacAddressArr[2] == null) ? "" : $AMacAddressArr[2]; ?>" name="AMacAddress2" id="AMacAddress2" size="70" maxlength="100" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">登入的Mac Address4</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AMacAddressArr == null || $AMacAddressArr[3] == null) ? "" : $AMacAddressArr[3]; ?>" name="AMacAddress3" id="AMacAddress3" size="70" maxlength="100" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">登入的Mac Address5</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AMacAddressArr == null || $AMacAddressArr[4] == null) ? "" : $AMacAddressArr[4]; ?>" name="AMacAddress4" id="AMacAddress4" size="70" maxlength="100" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">登入的Mac Address6</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AMacAddressArr == null || $AMacAddressArr[5] == null) ? "" : $AMacAddressArr[5]; ?>" name="AMacAddress5" id="AMacAddress5" size="70" maxlength="100" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">登入的Mac Address7</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AMacAddressArr == null || $AMacAddressArr[6] == null) ? "" : $AMacAddressArr[6]; ?>" name="AMacAddress6" id="AMacAddress6" size="70" maxlength="100" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">登入的Mac Address8</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AMacAddressArr == null || $AMacAddressArr[7] == null) ? "" : $AMacAddressArr[7]; ?>" name="AMacAddress7" id="AMacAddress7" size="70" maxlength="100" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">登入的Mac Address9</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AMacAddressArr == null || $AMacAddressArr[8] == null) ? "" : $AMacAddressArr[8]; ?>" name="AMacAddress8" id="AMacAddress8" size="70" maxlength="100" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">登入的Mac Address10</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($AMacAddressArr == null || $AMacAddressArr[9] == null) ? "" : $AMacAddressArr[9]; ?>" name="AMacAddress9" id="AMacAddress9" size="70" maxlength="100" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                            </td>
                        </tr>
                        <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="left">
                                <span class="t12">狀態</span>
                            </td>
                            <td align="left">
                                <input type="radio" value="1" <?php if ($AFlag == "1") {
                                                                    echo "checked";
                                                                } elseif ($AFlag == null) {
                                                                    echo "checked";
                                                                }
                                                                ?> name="AFlag">
                                <span class="t12">啟用</span>
                                <input type="radio" value="0" <?php if ($AFlag == "0") {
                                                                    echo "checked";
                                                                }
                                                                ?> name="AFlag">
                                <span class="t12">停用</span>
                            </td>
                        </tr>
                        <!--
                        
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">可登入的時段1</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[0] == null) ? "" : explode(":", explode("-", $ALogTimeArr[0])[0])[0]; ?>" name="ALogTime0_1_1" id="ALogTime0_1_1" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                時
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[0] == null) ? "" : explode(":", explode("-", $ALogTimeArr[0])[0])[1]; ?>" name="ALogTime0_1_2" id="ALogTime0_1_2" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                分 至
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[0] == null) ? "" : explode(":", explode("-", $ALogTimeArr[0])[1])[0]; ?>" name="ALogTime0_2_1" id="ALogTime0_2_1" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                時
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[0] == null) ? "" : explode(":", explode("-", $ALogTimeArr[0])[1])[1]; ?>" name="ALogTime0_2_2" id="ALogTime0_2_2" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                分
                                <br />
                                <font color="red">輸入格式 如 下午1點30分 請輸入 : 13時30分
                                    <br />若登入時段為24小時 請輸入00時00分 至 00時00分
                                </font>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">可登入的時段2</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[1] == null) ? "" : explode(":", explode("-", $ALogTimeArr[1])[0])[0]; ?>" name="ALogTime1_1_1" id="ALogTime1_1_1" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                時
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[1] == null) ? "" : explode(":", explode("-", $ALogTimeArr[1])[0])[1]; ?>" name="ALogTime1_1_2" id="ALogTime1_1_2" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                分 至
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[1] == null) ? "" : explode(":", explode("-", $ALogTimeArr[1])[1])[0]; ?>" name="ALogTime1_2_1" id="ALogTime1_2_1" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                時
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[1] == null) ? "" : explode(":", explode("-", $ALogTimeArr[1])[1])[1]; ?>" name="ALogTime1_2_2" id="ALogTime1_2_2" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                分
                                <br />
                                <font color="red">輸入格式 如 下午1點30分 請輸入 : 13時30分
                            </td>
                        </tr>
                        <tr>
                            <td align="left" width="15%">
                                <span class="t12">可登入的時段3</span>
                            </td>
                            <td align="left" width="85%">
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[2] == null) ? "" : explode(":", explode("-", $ALogTimeArr[2])[0])[0]; ?>" name="ALogTime2_1_1" id="ALogTime2_1_1" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                時
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[2] == null) ? "" : explode(":", explode("-", $ALogTimeArr[2])[0])[1]; ?>" name="ALogTime2_1_2" id="ALogTime2_1_2" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                分 至
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[2] == null) ? "" : explode(":", explode("-", $ALogTimeArr[2])[1])[0]; ?>" name="ALogTime2_2_1" id="ALogTime2_2_1" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                時
                                <input type="text" value="<?php echo ($ALogTimeArr == null || $ALogTimeArr[2] == null) ? "" : explode(":", explode("-", $ALogTimeArr[2])[1])[1]; ?>" name="ALogTime2_2_2" id="ALogTime2_2_2" size="2" maxlength="2" style="font-size: 12.0pt;font-family: 微軟正黑體;" />
                                分
                                <br />
                                <font color="red">輸入格式 如 下午1點30分 請輸入 : 13時30分
                            </td>
                        </tr>
                                                            -->
                        <tr>
                            <td align="center" colspan="2">
                                <input type="submit" name="btnSub" id="btnSub" value="<?php if ($action == "Insert") {
                                                                                            echo "確認新增";
                                                                                        } else {
                                                                                            echo "確認修改";
                                                                                        }
                                                                                        ?>" class="t12" />
                            </td>
                        </tr>
                    </table>

                </td>
            </tr>
        </table>
    </form>
    <script language="javascript">
        <?php
        if ($_SESSION['rightLevel'] == "1" || $ARightLevel == "2") {
        ?>
            document.getElementById("a3").style.display = "";
        <?php
        }
        ?>
    </script>
</body>

</html>