summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/config.php4
-rw-r--r--inc/functions.php3
-rw-r--r--inc/user.php4
3 files changed, 8 insertions, 3 deletions
diff --git a/inc/config.php b/inc/config.php
index 4bd09080..b6c33eaf 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -47,7 +47,9 @@
$config['cookies']['hash'] = 'hash';
// Used for moderation login
$config['cookies']['mod'] = 'mod';
- // Where to set the 'path' parameter to $config['root'] when creating cookies. Recommended.
+ // Cookies "path". Defaults to $config['root']. If $config['root'] is a URL, you need to set this. Should be '/' or '/board/', depending on your installation.
+ // $config['cookies']['path'] = '/';
+ // Where to set the 'path' parameter to $config['cookies']['path'] when creating cookies. Recommended.
$config['cookies']['jail'] = true;
// How long should the cookies last (in seconds)
$config['cookies']['expire']= 15778463; //6 months
diff --git a/inc/functions.php b/inc/functions.php
index a00d62d7..4ee5b4ae 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -39,6 +39,9 @@
'\?\/.+' .
')$/i';
+ if(!isset($config['cookies']['path']))
+ $config['cookies']['path'] = $config['root'];
+
if(!isset($config['dir']['static']))
$config['dir']['static'] = $config['root'] . 'static/';
diff --git a/inc/user.php b/inc/user.php
index 021515a2..1c05b3a1 100644
--- a/inc/user.php
+++ b/inc/user.php
@@ -16,8 +16,8 @@
if(!isset($_COOKIE[$config['cookies']['hash']]) || !isset($_COOKIE[$config['cookies']['time']]) || $_COOKIE[$config['cookies']['hash']] != md5($_COOKIE[$config['cookies']['time']] . $config['cookies']['salt'])) {
$time = time();
- setcookie($config['cookies']['time'], $time, time()+$config['cookies']['expire'], $config['cookies']['jail']?$config['root']:'/', null, false, true);
- setcookie($config['cookies']['hash'], md5($time . $config['cookies']['salt']), $time+$config['cookies']['expire'], $config['cookies']['jail']?$config['root']:'/', null, false, true);
+ setcookie($config['cookies']['time'], $time, time()+$config['cookies']['expire'], $config['cookies']['jail']?$config['cookies']['path']:'/', null, false, true);
+ setcookie($config['cookies']['hash'], md5($time . $config['cookies']['salt']), $time+$config['cookies']['expire'], $config['cookies']['jail']?$config['cookies']['path']:'/', null, false, true);
$user = Array('valid' => false, 'appeared' => $time);
} else {
$user = Array('valid' => true, 'appeared' => $_COOKIE[$config['cookies']['time']]);