Welcome to WebmasterWorld Guest from 220.127.116.11
setcookie("user", "Alex", $expire);
echo "Welcome " . $_COOKIE["user"] . "<br>";
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?
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");
Just use their username to get their information, but check if that session variable equals that to see if they are logged in.