-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgameHeader.php
112 lines (83 loc) · 2.59 KB
/
gameHeader.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
date_default_timezone_set('UTC');
if(isset($_SERVER['HTTP_REFERER'])){
$ref = $_SERVER['HTTP_REFERER'];
} else {
$ref = '';
}
if(isset($_SESSION['id'])){
// $_SESSION['id'] = 1;
if(!is_int((int)$_SESSION['id'])){
exit('Invalid session id.');
}
require_once 'classes/Ranking.class.php';
$ranking = new Ranking();
$session = new Session();
$pdo = PDO_DB::factory();
$session->newQuery();
$sql = "SELECT lang FROM users_language WHERE userID = '".$_SESSION['id']."' LIMIT 1";
// require 'classes/EmailVerification.class.php';
// $emailVerification = new EmailVerification();
//
// if(!$emailVerification->isVerified($_SESSION['id'])){
// header("Location:welcome");
// exit();
// }
//
// if((!$ranking->cert_have('1')) && ($_SERVER['SCRIPT_NAME'] != '/university.php' || ($_SERVER['SCRIPT_NAME'] == '/university.php' && !isset($_GET['opt']))) && $_SERVER['SCRIPT_NAME'] != '/welcome.php'){
// header("Location:welcome");
// }
if($_SESSION['ROUND_STATUS'] != 1){
$redirect = TRUE;
switch($_SERVER['SCRIPT_NAME']){
case '/index.php':
#case '/index':
case '/ajax.php':
#case '/ajax':
case '/ranking.php':
#case '/ranking':
case '/fame.php':
#case '/fame':
case '/stats.php':
#case '/stats':
case '/mail.php':
#case '/mail':
case '/settings.php':
#case '/settings':
case '/profile.php':
#case '/profile':
case '/clan.php':
#case '/clan':
$redirect = FALSE;
break;
}
if($redirect){
header("Location:index");
}
}
if(!$session->validLogin()){
$session->logout(0);
header("Location:index");
exit();
}
$curDate = new DateTime('now');
$curDate->modify('-5 minutes');
$checkDiff = $curDate->diff($_SESSION['LAST_CHECK']);
if($checkDiff->invert == 1){
if($checkDiff->i < 2){
$ranking->updateTimePlayed();
}
$_SESSION['LAST_CHECK'] = new DateTime('now');
}
} else {
$_SESSION['GOING_TO'] = $_SERVER['REQUEST_URI'];
if(!isset($_SESSION)){
session_start();
}
$_SESSION['MSG'] = 'You are not logged in.';
$_SESSION['TYP'] = 'index';
$_SESSION['MSG_TYPE'] = 'error';
header("Location:index");
exit();
}
?>