-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckin.php
51 lines (40 loc) · 1.09 KB
/
checkin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
session_start();
// 判断是否登录过
if (!isset($_SESSION["USERID"])) {
header("Location: logout.php");
exit;
}
//require 'password.php';
require 'dbConfig.php';
$link = mysql_connect($dbIp, $dbUser, $dbPwd);
if (!$link) {
die('连接数据库失败。'.mysql_error());
}
$db_selected = mysql_select_db($dbNm, $link);
if (!$db_selected){
die('选择数据库失败。'.mysql_error());
}
mysql_set_charset('utf8', $link);
$sql = "INSERT INTO t_checkin (userId) VALUES ('" . $_SESSION["uid"] ."')";
$result_flag = mysql_query($sql);
if (!$result_flag) {
die('签到数据插入失败,请联系管理员。<br><a href="login.php">戻る</a>');
}
print('<p>' . $_SESSION["USERID"] . '用户签到成功。</p>');
$close_flag = mysql_close($link);
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>签到</title>
</head>
<body>
<h1>签到</h1>
<p>欢迎您,<?=htmlspecialchars($_SESSION["USERID"], ENT_QUOTES); ?> </p>
<ul>
<li><a href="logout.php">退出</a></li>
</ul>
</body>
</html>