summaryrefslogtreecommitdiff
path: root/inc/user.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2010-12-01 16:42:48 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2010-12-01 16:42:48 +1100
commit5c7de28ca61b00495fbf26c449bb5d5ed38d8669 (patch)
tree2c9cb16261b9c6b3ec4907395c1d7d002c2efa01 /inc/user.php
parent5e63b4b8a0c6e982bdb01299c1ce175d521b2d35 (diff)
JAIL_COOKIES config directive.
Diffstat (limited to 'inc/user.php')
-rw-r--r--inc/user.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/inc/user.php b/inc/user.php
index 1dad35f9..0b9af643 100644
--- a/inc/user.php
+++ b/inc/user.php
@@ -1,14 +1,21 @@
<?php
+ // Set the session name.
session_name(SESS_COOKIE);
- session_start();
+ // Set session parameters
+ session_set_cookie_params(0, JAIL_COOKIES?ROOT:'/');
+
+ // Start the session
+ session_start(COOKIE_EXPIRE);
+
+ // Session creation time
if(!isset($_SESSION['created'])) $_SESSION['created'] = time();
if(!isset($_COOKIE[HASH_COOKIE]) || !isset($_COOKIE[TIME_COOKIE]) || $_COOKIE[HASH_COOKIE] != md5($_COOKIE[TIME_COOKIE].SALT)) {
$time = time();
- setcookie(TIME_COOKIE, $time, time()+COOKIE_EXPIRE, '/', null, false, true);
- setcookie(HASH_COOKIE, md5(time().SALT), time()+COOKIE_EXPIRE, '/', null, false, true);
+ setcookie(TIME_COOKIE, $time, time()+COOKIE_EXPIRE, JAIL_COOKIES?ROOT:'/', null, false, true);
+ setcookie(HASH_COOKIE, md5(time().SALT), time()+COOKIE_EXPIRE, JAIL_COOKIES?ROOT:'/', null, false, true);
$user = Array('valid' => false, 'appeared' => $time);
} else {
$user = Array('valid' => true, 'appeared' => $_COOKIE[TIME_COOKIE]);