Think I may have figured this one. Just wanting to check on a couple of points, however. Firstly, will calling this each time from header.php lead to performance/load problems at all? Is there a better way to do it? The cookie settings don't appear to be available from within header.php by default, or have I missed something?
if ($pun_user['is_guest'] && isset($_COOKIE[$cookie_name]))
{
list(, , $header['group_id']) = @unserialize($_COOKIE[$cookie_name]);
}
Also could I just check that I haven't cocked anything up with these changes. These are all the instances I've changed with regards to the cookie settings:
include/functions.php: $cookie = array('user_id' => 1, 'password_hash' => 'Guest', 'group_id' => '3');
include/functions.php: list($cookie['user_id'], $cookie['password_hash'], $cookie['group_id']) = @unserialize($_COOKIE[$cookie_name]);
include/functions.php: pun_setcookie(0, random_pass(8), 3, $expire);
include/functions.php:function pun_setcookie($user_id, $password_hash, $group_id, $expire)
include/functions.php: setcookie($cookie_name, serialize(array($user_id, md5($cookie_seed.$password_hash), $group_id)), $expire, $cookie_path, $cookie_domain, $cookie_secure, true);
include/functions.php: setcookie($cookie_name, serialize(array($user_id, md5($cookie_seed.$password_hash), $group_id)), $expire, $cookie_path.'; HttpOnly', $cookie_domain, $cookie_secure);
login.php: pun_setcookie($user_id, $form_password_hash, $group_id, $expire);
login.php: pun_setcookie(1, random_pass(8), $pun_user['g_id'], time() + 31536000);
profile.php: pun_setcookie($pun_user['id'], $new_password_hash, $pun_user['g_id'], $expire);
profile.php: pun_setcookie($id, $db->result($result), $pun_user['g_id'], ($form['save_pass'] == '1') ? time() + 31536000 : 0);
register.php: pun_setcookie($new_uid, $password_hash, $initial_group_id, ($save_pass != '0') ? $now + 31536000 : 0);
Btw, just on a slight sidetrack, is there any reason other than a propogated mis-spell that $initial_group_id is actually set as $intial_group_id, originally?
Thanks again,
Matt