I'm trying to set a session and a cookie for when user logs in.
When the user visits the login page, a session is set and started, with session_start()
which is working quite alright, but when the user now fills in the login form (with username and password) and the proper check is done for correct login details, I set the cookie:
$one_week = 60*60*24*7;
setcookie("cookiejarcookie", "cookiejar_value", time()+$one_week, '/', 'localhost');
It's not working, the cookie is not being set. I've tried calling it from the top of the script, but it's not working.
How do I set the cookie after setting the session?