i have a session variable "username" and "password" set but my session seems to die after browser closes.
any ideas?
PHP session
Moderator: General Moderators
That's what sessions do. They die when browser is closed. That's what it is supposed to do. Now, if you venture OFF your website, but still have the original window open, you can go back to the website and the session should still be alive. It's called security. There's even a way to kill a session if they venture out of the website...
Sessions aren't like cookies: They love to die when things are over, unlike cookies, which die whenever their timer ends.
Sessions aren't like cookies: They love to die when things are over, unlike cookies, which die whenever their timer ends.
session's are going to get garbage collected so storing the session id is no good, you want to store the username and some how safely store a hash of the password.
Loading it back is self explanatory:
Loading it back is self explanatory:
Code: Select all
if (!isset($_SESSION['value'])) {
if (!isset($_COOKIE['value'])) {
$_SESSION['value']=$_COOKIE['value'];
}
}