forked from stefangabos/Zebra_Session
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSessionConfig.php
More file actions
58 lines (46 loc) · 1.23 KB
/
Copy pathSessionConfig.php
File metadata and controls
58 lines (46 loc) · 1.23 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
<?php
namespace steamegg\SessionDatabase;
class SessionConfig {
private $security_code;
private $fingerprint;
private $session_lifetime;
private $gc_probability;
private $gc_divisor;
private $table;
function __construct(
$security_code,
$fingerprint,
$session_lifetime,
$gc_probability,
$gc_divisor,
$table = 'session_data'){
$this->security_code = $security_code;
$this->fingerprint = $fingerprint;
if(!is_numeric($session_lifetime))
trigger_error("session_lifetime is not numeric", E_USER_ERROR);
$this->session_lifetime = $session_lifetime;
if(!is_numeric($gc_probability))
trigger_error("gc_probability is not numeric", E_USER_ERROR);
$this->gc_probability = $gc_probability;
if(!is_numeric($gc_divisor))
trigger_error("gc_divisor is not numeric", E_USER_ERROR);
$this->gc_divisor = $gc_divisor;
$this->table = $table;
}
function getSessionLifetime(){
return $this->session_lifetime;
}
function getGcProbability(){
return $this->gc_probability;
}
function getGcDivisor(){
return $this->gc_divisor;
}
function getTable(){
return $this->table;
}
function calculateHash(){
$hash = sprintf("%s%s", $this->security_code, $this->fingerprint);
return md5($hash);
}
}