MDanz Posted September 17, 2009 Share Posted September 17, 2009 $username = $_POST['username']; $password = $_POST['password']; if($username&&$password){ } else { } where it says else.. i have an user account known as guest. how do i have the guest account already logged in. i know it Sessions, how do i use sessions to have it logged in as guest if a username and password aren't provided? in simple how do i use session to have it logged in automatically as a user? i normally do $_SESSION['username']=$username; thats the user logged in, i don't know how to have it logged in without providing a username and password example.. Quote Link to comment Share on other sites More sharing options...
khr2003 Posted September 17, 2009 Share Posted September 17, 2009 it really depends on how you setup your login system. If you are using cookies then you can add a cookie with a username and a password in the else condition, so when your program checks for a member it will find this cookie and use it as a user. if you are using sessions to authenticate your users when they log in, you might want to read how to initiate sessions and how to add variable to this sessions array. check this link: http://au.php.net/manual/en/book.session.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.