1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-28 01:10:51 +01:00

Fixed a bug making logins fail on Firefox if $config["root"] is a URL

This commit is contained in:
Savetheinternet 2011-03-28 02:22:48 +11:00
parent d919c49b2f
commit f7313d4a0e
3 changed files with 8 additions and 3 deletions

View File

@ -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

View File

@ -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/';

View File

@ -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']]);