-
Notifications
You must be signed in to change notification settings - Fork 0
/
auth.php
42 lines (36 loc) · 1.39 KB
/
auth.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
<?php
// **********************************************************************************
// ** **
// ** auth.php (c) Wolfram Plettscher 12/2015 **
// ** **
// **********************************************************************************
include "inc/globalvars.inc";
if (session_id() == '') {
session_start();
}
$hostname = $_SERVER['HTTP_HOST'];
$path = dirname($_SERVER['PHP_SELF']);
// check, if user is properly logged-in
if (!isset($_SESSION['loggedin']) || !$_SESSION['loggedin']) {
// no, therefore go to login-page
if (defined ('HOSTEUROPE_SSLPROXY')) {
header('Location: https://ssl.webpack.de/'.$hostname.($path == '/' ? '' : $path).'/login.php');
} else {
header('Location: http://'.$hostname.($path == '/' ? '' : $path).'/login.php');
}
exit;
}
// check, if 10 Minute timer has expired
if (time() - $_SESSION['TIME'] > 600) {
// yes, counter expired; goto login-page
session_destroy();
if (defined ('HOSTEUROPE_SSLPROXY')) {
header('Location: https://ssl.webpack.de/'.$hostname.($path == '/' ? '' : $path).'/login.php');
} else {
header('Location: http://'.$hostname.($path == '/' ? '' : $path).'/login.php');
}
exit;
}
// re-establish 10 Minute timer
$_SESSION['TIME'] = time();
?>