Browse Source

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

pull/40/head
Savetheinternet 12 years ago
parent
commit
f7313d4a0e
  1. 4
      inc/config.php
  2. 3
      inc/functions.php
  3. 4
      inc/user.php

4
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

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

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

Loading…
Cancel
Save