Zoud Posted January 16, 2007 Share Posted January 16, 2007 What's wrong this this:[code]<?phpif(isset($_SESSION[username])) { echo "You are logged in as: <b>$_SESSION[username]</b> <input type='button' value='Log Out!' href='http://www.eliteguards.us/logout.php'>";} else { echo "<form action='http://www.eliteguards.us/login_check.php' name='login' method='post'>Username:<input type='text' name='username'> Password:<input type='password' name='password'> <input type='submit' value='Log In!'></form><br />";}?>[/code]Darn those PHP white page errors! >:( Link to comment https://forums.phpfreaks.com/topic/34456-session-checking/ Share on other sites More sharing options...
Daniel0 Posted January 16, 2007 Share Posted January 16, 2007 First of all: What you put as the key is a constant named 'username'. DO NOT DO THAT (I've seen that so many times). You need to encapsulate it in single or double quotes.Now what the problem actually is, is that you have not run session_start() before trying to use sessions. A good idea is to place it at the top of your script. Link to comment https://forums.phpfreaks.com/topic/34456-session-checking/#findComment-162249 Share on other sites More sharing options...
Zoud Posted January 16, 2007 Author Share Posted January 16, 2007 Eep! Nevermind! Got it to work... I just forgot the "; at the end of the echo. :-[ Link to comment https://forums.phpfreaks.com/topic/34456-session-checking/#findComment-162250 Share on other sites More sharing options...
Recommended Posts