This repository was archived by the owner on Nov 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathlogout.php
More file actions
54 lines (39 loc) · 1.37 KB
/
logout.php
File metadata and controls
54 lines (39 loc) · 1.37 KB
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
52
53
54
<?php
require_once('inc/common.inc.php');
//Connect to the database
db_connect();
check_auth();
//admin logout
if ($login_id == ADMIN_ID) {
db("update se_games set session_id = 0, session_exp=0 where db_name = '$db_name'");
insert_history(1, "Logged Out");
//logout FROM GAME. to either gamelisting or index
} elseif(isset($logout_single_game) || isset($comp_logout)){
dbn("update ${db_name}_users set on_planet = 0 where login_id = '$login_id'");
dbn("update user_accounts set in_game = '' where login_id = '$login_id'");
SetCookie("p_pass","",0);
//Update score, and last_request
score_func($login_id,0);
$time_to_set = time() - 1800; //30 mins ago
dbn("update ${db_name}_users set last_request = '$time_to_set' where login_id = '$login_id'");
//only logging out to gamelisting
if(isset($logout_single_game)){
insert_history($login_id,"Logged Out of $db_name");
header('Location: game_listing.php');
exit;
}
}
//totally leaving the game
if(!empty($db_name) && $login_id != 1){
if(isset($comp_logout)) {//logging out directly from game to index
score_func($login_id, 0);
}
insert_history($login_id,"Logged Out Completely");
SetCookie("p_pass","",0);
}
//unset session details.
dbn("update user_accounts set session_id = '', session_exp = 0 where login_id = '$login_id'");
SetCookie("session_id",0,0);
SetCookie("login_id",0,0);
header('Location: login_form.php');
?>