-
Notifications
You must be signed in to change notification settings - Fork 2
/
checklogin.php
138 lines (122 loc) · 4.62 KB
/
checklogin.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
include_once 'phppagestart.php';
include_once 'lang.php';
include_once 'config.inc.php';
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
$now = time();
$logininsec = ($_SESSION['expire'] - $now);
if (( $requireauth == 'yes' ) && ( $_SESSION['loggedin'] == 'yes' ) && ( $_SESSION['expire'] > ($now + $addtime) ))
{
if (round(($logininsec / 60), 0, PHP_ROUND_HALF_DOWN) == 1 )
{
$min=$minute;
}
else
{
$min=$minutes;
}
$loginmessagetxt='<span style="font-size: larger; color:#484; font-weight:bold">'.$sessionexpiresin.round(($logininsec / 60), 0, PHP_ROUND_HALF_DOWN).$min.'</span>' ;
}
elseif (( $requireauth == 'yes' ) && ( $_SESSION['loggedin'] == 'yes' ) && ( $_SESSION['expire'] <= ($now + $addtime)) && (($_SESSION['expire'] - $now) > 120))
{
if (round(($logininsec / 60), 0, PHP_ROUND_HALF_DOWN) == 1 )
{
$min=$minute;
}
else
{
$min=$minutes;
}
if ($_SESSION['fromfilelister']!='imageedit')
{
$loginmessagetxt='<span style="font-size: larger; color:#A80; font-weight:bold">'.$sessionexpiresin.round(($logininsec / 60), 0, PHP_ROUND_HALF_DOWN).$min.'</span></td><td> '.$increasetime ;
}
elseif ($_SESSION['fromfilelister']=='imageedit')
{
$loginmessagetxt='<span style="font-size: larger; color:#A80; font-weight:bold">'.$sessionexpiresin.round(($logininsec / 60), 0, PHP_ROUND_HALF_DOWN).$min.'</span></td><td> ';
}
}
elseif (( $requireauth == 'yes' ) && ( $_SESSION['loggedin'] == 'yes' ) && ( $_SESSION['expire'] <= ($now + $addtime)) && (($_SESSION['expire'] - $now) > 0))
{
if (round(($logininsec / 60), 0, PHP_ROUND_HALF_DOWN) == 1 )
{
$min=$minute;
}
else
{
$min=$minutes;
}
if ($_SESSION['fromfilelister']!='imageedit')
{
$loginmessagetxt='<span style="font-size: larger; color:#F44; font-weight:bold">'.$sessionexpiresin.round(($logininsec / 60), 0, PHP_ROUND_HALF_DOWN).$min.'</span></td><td> '.$increasetime ;
}
elseif ($_SESSION['fromfilelister']=='imageedit')
{
$loginmessagetxt='<span style="font-size: larger; color:#F44; font-weight:bold">'.$sessionexpiresin.round(($logininsec / 60), 0, PHP_ROUND_HALF_DOWN).$min.'</span></td><td> ';
}
}
elseif (( $requireauth == 'yes' ) && ( $_SESSION['loggedin'] == 'yes' ) && (($_SESSION['expire'] - $now) <= 0))
{
// $logininsec = ($_SESSION['expire'] - $now);
$loginmessagetxt='<span style="font-size: larger; color:#F44; font-weight:bold">'.$sessionexpired.'</span></td><td> <a href="/login.php"><span style="font-size: larger; color:#777AFF; font-weight:bold">'.$login.'</span></a>';
session_unset($_SESSION["loggedin"]);
session_unset($_SESSION["expire"]);
session_unset($_SESSION["username"]);
session_unset($_SESSION["password"]);
session_unset($_SESSION["userpath"]);
session_unset($_SESSION['scanneronline']);
session_unset($_SESSION['fromuserfolder']);
session_unset($_SESSION['fromuserfilelister']);
session_destroy();
// $loginjsrefresh = '7200000';
// $loginmessagetxt= '<script>
// function myFunction() {
// location.reload();
// }
// </script>';
}
/*
elseif (( $requireauth == 'yes' ) && ( $_SESSION['loggedin'] == 'yes' ) && (($_SESSION['expire'] - $now) <= 0))
{
session_unset($_SESSION["loggedin"]);
session_unset($_SESSION["expire"]);
session_unset($_SESSION["username"]);
session_unset($_SESSION["password"]);
session_unset($_SESSION["userpath"]);
session_destroy();
$loginmessagetxt= '<script>
function myFunction() {
location.reload();
}
</script>';
}
*/
elseif ($requireauth !='yes')
{
$loginmessagetxt= '';
}
else
{
// $logininsec = ($_SESSION['expire'] - $now);
$loginmessagetxt='<span style="font-size: larger; color:#F44; font-weight:bold">'.$sessionexpired.'</span></td><td> <a href="/login.php"><span style="font-size: larger; color:#777AFF; font-weight:bold">'.$login.'</span></a>';
session_unset($_SESSION["loggedin"]);
session_unset($_SESSION["expire"]);
session_unset($_SESSION["username"]);
session_unset($_SESSION["password"]);
session_unset($_SESSION["userpath"]);
session_unset($_SESSION['scanneronline']);
session_unset($_SESSION['fromuserfolder']);
session_unset($_SESSION['fromuserfilelister']);
session_destroy();
// $loginjsrefresh = '7200000';
}
// echo $_SESSION['expire'];
echo "retry: $loginjsrefresh\n\ndata: {$loginmessagetxt}\n\n";
/*
elseif (( $requireauth == 'yes' ) && ( $_SESSION['loggedin'] == 'yes' ) && ( $_SESSION['expire'] >= $now ) && ($_SESSION['expire'] - $now) <= $addtime))
{
$loginmessagetxt=$sessionexpiresin.round(($logininsec / 60), 0, PHP_ROUND_HALF_DOWN).$increasetime ;
}
*/
?>