-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_static.session.inc.php
More file actions
49 lines (38 loc) · 942 Bytes
/
_static.session.inc.php
File metadata and controls
49 lines (38 loc) · 942 Bytes
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
<?php
session_start();
$path = explode('/', dirname($_SERVER [ 'PHP_SELF' ]));
$realm = array_pop($path);
function validate_session()
{
if (empty($_SESSION [ 'user' ])) {
loginform();
}
global $realm;
switch ($realm) {
case 'hosts':
case 'domains':
if (!$_SESSION [ 'admin' ]) {
loginform();
}
break;
}
}
function loginform()
{
header('Location: http://' . $_SERVER [ 'HTTP_HOST' ] . '/mailadmin/login.php');
exit(0);
}
function remove_session()
{
global $dba;
// initialize the session
// remove all session information
$_SESSION = array();
// remove the whole session information.
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
// remove the session itself.
session_destroy();
return true;
}