签到信息修改

This commit is contained in:
筱锋xiao_lfeng 2022-09-11 14:02:41 +08:00
parent 96581bd8e2
commit 042e5b6280
3 changed files with 47 additions and 4 deletions

View File

@ -19,6 +19,9 @@ if ($key == $setting['Key']) {
if ($type == 'normal') { if ($type == 'normal') {
if (!empty($studentID)) { if (!empty($studentID)) {
mysqli_query($conn,"LOCK TABLE ".$setting['SQL_DATA']['signin']." WRITE"); mysqli_query($conn,"LOCK TABLE ".$setting['SQL_DATA']['signin']." WRITE");
$result_person = mysqli_query($conn,"SELECT * FROM ".$setting['SQL_DATA']['signin']." WHERE studentID=$studentID");
$result_person_object = mysqli_fetch_object($result_person);
if (empty($result_person_object->signin_20220911)) {
if (mysqli_query($conn,"UPDATE ".$setting['SQL_DATA']['signin']." SET signin_20220911='TRUE',time_20220911='$time' WHERE studentID='$studentID'")) { if (mysqli_query($conn,"UPDATE ".$setting['SQL_DATA']['signin']." SET signin_20220911='TRUE',time_20220911='$time' WHERE studentID='$studentID'")) {
// 编译数据 // 编译数据
$data = array( $data = array(
@ -28,6 +31,25 @@ if ($key == $setting['Key']) {
); );
// 输出数据 // 输出数据
echo json_encode($data,JSON_UNESCAPED_UNICODE); echo json_encode($data,JSON_UNESCAPED_UNICODE);
} else {
// 编译数据
$data = array(
'output'=>'ERROR',
'code'=>200,
'info'=>'签到失败,数据库错误',
);
// 输出数据
echo json_encode($data,JSON_UNESCAPED_UNICODE);
}
} else {
// 编译数据
$data = array(
'output'=>'ALREADY_SIGNIN',
'code'=>200,
'info'=>'您已签到过了!',
);
// 输出数据
echo json_encode($data,JSON_UNESCAPED_UNICODE);
} }
mysqli_query($conn,"UNLOCK TABLE"); mysqli_query($conn,"UNLOCK TABLE");
} else { } else {

View File

@ -45,7 +45,7 @@ $menu_page = 8;
<div class="row text-center"> <div class="row text-center">
<div class="col-12 fs-5 fw-bold mb-3">军训服装集合领取签到</div> <div class="col-12 fs-5 fw-bold mb-3">军训服装集合领取签到</div>
<?PHP <?PHP
if ($_COOKIE['studentID'] = '22344233' or $_COOKIE['studentID'] = '22344231' or $_COOKIE['studentID'] = '22344218' or $_COOKIE['studentID'] = '22344219' or $_COOKIE['studentID'] = '22344216') { if ($_COOKIE['studentID'] == '22344233' or $_COOKIE['studentID'] == '22344231' or $_COOKIE['studentID'] == '22344218' or $_COOKIE['studentID'] == '22344219' or $_COOKIE['studentID'] == '22344216') {
?> ?>
<div class="col-12 my-3">查询到场人 <a class="btn btn-danger" href="./admin_20220911.php" role="button">查询</a></div> <div class="col-12 my-3">查询到场人 <a class="btn btn-danger" href="./admin_20220911.php" role="button">查询</a></div>
<?PHP <?PHP

View File

@ -37,6 +37,27 @@ if (!empty($studentID)) {
window.history.go(-1); window.history.go(-1);
</script> </script>
EOF; EOF;
} elseif ($signin['output'] == 'ALREADY_SIGNIN') {
echo <<<EOF
<script language="javascript">
alert( "您已签到过了" )
window.history.go(-1);
</script>
EOF;
} elseif ($signin['output'] == 'USER_NONE') {
echo <<<EOF
<script language="javascript">
alert( "缺少用户信息" )
window.history.go(-1);
</script>
EOF;
} elseif ($signin['output'] == 'ERROR') {
echo <<<EOF
<script language="javascript">
alert( "数据库错误" )
window.history.go(-1);
</script>
EOF;
} else { } else {
echo <<<EOF echo <<<EOF
<script language="javascript"> <script language="javascript">