-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckSessions.php
More file actions
77 lines (59 loc) · 2.38 KB
/
CheckSessions.php
File metadata and controls
77 lines (59 loc) · 2.38 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?PHP
// CheckSessions.php
// Skriven av Eli Kaufman för Daft
// Copyright Daft 2003 under GPL
// This file is part of PHPDaft.
// PHPDaft is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// PHPDaft is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with PHPDaft; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// Visa var filerna finns
ini_set("include_path", "/home/daft/konferens/");
// Inkludera filer
require("Functions/function_errorHandler.php");
require("Classes/class_Configuration.php");
require("Classes/class_ExternalStorage.php");
require("Classes/class_User.php");
require("Classes/class_UserPresentation.php");
require("Classes/class_Logger.php");
// Definiera felhanterare
// set_error_handler("errorHandler");
$sDir = session_save_path();
// Öppna katalog
if (!($rDir = opendir($sDir)))
trigger_error("46", E_USER_ERROR);
// Loopa igenom sessioner
while (!(FALSE ===($sFile = readdir($rDir)))) {
if (fnmatch("sess_*", $sFile)) {
if ($sTemp = file_get_contents($sDir."/".$sFile)) {
// Finns iValid?
if (!(substr($sTemp, -25, 14) == "iValidUntil|i:"))
trigger_error("48", E_USER_WARNING);
if (substr($sTemp, -11, -1) < time()) { // Tiden har löpt ut
// Ta fram oUser
if (!($sTemp = substr($sTemp, 6, strrpos($sTemp, "}") - 6)))
trigger_error("48", E_USER_WARNING);
if (!($sTemp = substr($sTemp, 0, strrpos($sTemp, "}") + 1)))
trigger_error("48", E_USER_WARNING);
// Deserialisera
$oUser = unserialize($sTemp);
// Fixa egen oData, han verkar inte ?verleve deserialiseringen
$oData = ExternalStorage::createInstance();
$oData->markOffline($oUser->getID());
// Logga ut
//if (!($oUser->logOff()))
// trigger_error("49: ".$oUser->getErrorMsg(), E_USER_WARNING);
// Ta bort fil
unlink($sDir."/".$sFile);
}
}
}
}
?>