Howdy, I'm trying to write a website that allows people to login via a cookie that will expire when they close the browser. I was under the impression that if you don't include an expiration time when you set the cookie that it will automatically expire when the browser window is closed. Here is what I've got:
if (mysql_num_rows($result)==1 ) { // if name matches password
setcookie("loggedid", $userid);
header ("location: index.php");
exit;
}
and index.php tests for the cookie and displays 'Welcome...' if they are logged in...anyway, if i open index.php it doesn't say welcome, then if i log in, it goes to the index.php and i see 'Welcome...', so the cookie has been set. However, if I close the browser window after that and then reopen it and go to index.php, it still displays 'Welcome...' and i am still logged in. Why? FYI I don't have PHP on my computer, I have to upload it to my server; maybe it is something in their php.ini settings