blob: b8bc7bd6f335382596cd3a8ddd287882e431aaf8 (
plain)
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
|
<?php
class GenericSessionHandler implements SessionHandlerInterface
{
function open($savePath, $sessionName) { return true; }
function close() { return true; }
function read($id) { return (string)""; }
function write($id, $data) { return true; }
function destroy($id) { return true; }
function gc($maxlifetime) { return true; }
}
class WriteSessionHandler extends GenericSessionHandler
{
function write($id, $data)
{
echo "SESSION: $data\n";
return true;
}
}
class RemoteAddrSessionHandler extends GenericSessionHandler
{
## key empty and REMOTE_ADDR set to 127.0.0.1
function read($id) { return (string)"j1YTvIOAUqxZMjuJ_ZnHPHWY5XEayycsr7O94aMzmBQ."; }
}
function session_test_start($handler=null) {
if (!$handler) {
$handler = new WriteSessionHandler();
}
session_set_save_handler($handler, true);
session_start();
return $handler;
}
?>
|