-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckUsers.php
executable file
·47 lines (47 loc) · 1.32 KB
/
checkUsers.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
<?php
/**
* Created by PhpStorm.
* User: KaiGod
* Date: 17-6-10
* Time: 上午3:33
*/
function checkUsers()
{
session_start();
if (!(isset($_SESSION['username']) && isset($_SESSION['passhash']))) {
echo "<script language=
\"JavaScript\">\r\n";
echo " alert(\"You are not logining in or logining is expired,please login in again\");\r\n";
echo " location.replace
(\"http://localhost/outeruser_login.php\");\r\n"; // 自己修改网址
echo "</script>";
exit;
}
}
function destorySession()
{
session_start();
$olduser=$_SESSION['username'];
unset($_SESSION['username']);
unset($_SESSION['passhash']);
session_destroy();
if(!empty($olduser)) {
echo "<script language=
\"JavaScript\">\r\n";
echo " alert(\"You are logining out!\");\r\n";
echo " location.replace
(\"http://localhost/outeruser_login.php\");\r\n"; // 自己修改网址
echo "</script>";
exit;
}
else{
echo "<script language=
\"JavaScript\">\r\n";
echo " alert(\"You are not login in!\");\r\n";
echo " location.replace
(\"http://localhost/outeruser_login.php\");\r\n"; // 自己修改网址
echo "</script>";
exit;
}
}
?>