Forum Moderators: coopster
setcookie("user", "Alex", $expire);
if (isset($_COOKIE["user"]))
echo "Welcome " . $_COOKIE["user"] . "<br>";
else
echo "Welcome guest";
How can I do the exact same thing but with PHP sessions so that as long as the current browser window is opened the session info will always remain?
thanks
you can change that of course
but you cannot relog the user on next visit. You will force him to re-login manually
//if the user is logged in set the variable to this
$_SESSION['userLogged'] = md5("loggedIn");
var_dump($_SESSION['userLogged']);
Just use their username to get their information, but check if that session variable equals that to see if they are logged in.