When someone logins sucessfully I regenerate a new session and delete the old one, and add some variables to the session, but I also add a random token.
The random token for the session and cookie must match each other, because the check_logged_in() will test both of them, along with filtering and checking the other variables
//random token
$token = md5(uniqid(rand(), true));
$_SESSION['token'] = $token;
setcookie('token', $token, 0, '/', '');
I was wondering if this would be good for security? Or could someone just make the cookie up? I wouldnt think so because they would have to change the one for the session. The more I think about it the more I get confused 😕