dachshund Posted August 28, 2009 Share Posted August 28, 2009 Hi, This log in form is supposed to check if they are already logged in and if they are echo ACCOUNT | LOGOUT. But when they're logged in, it just doesn't echo anything and it's just blank. Can anyone see where i'm going wrong? <?php if ($_SESSION['uid']){ echo "ACCOUNT | LOGOUT\n"; }else { if(!$_POST['submit'] == 'login'){ echo "<div id=\"blanket\" style=\"display:none;\"></div>\n"; echo "<div id=\"popUpDiv\" style=\"display:none;\">\n"; echo "<a href=\"#\" onclick=\"popup('popUpDiv')\">Close</a>\n"; echo "<form name=\"login\" method=\"post\" action=\"#\">\n"; echo "<p>Username <input name=\"username\" type=\"text\"></p>\n"; echo "<p>Password <input name=\"password\" type=\"password\"></p>\n"; echo "<p class=\"submitbutton\">\n"; echo "<div align=\"left\">\n"; echo "<input type=\"submit\" name=\"submit\" class=\"loginformtext\" value=\"Submit\">\n"; echo "</div>\n"; echo "</p>\n"; echo "</form>\n"; echo "<span class=\"login_text\"><a href=\"#\" onclick=\"popup('popUpDiv')\">LOG IN</a>\n"; echo "</div>\n"; }else { $user= $_POST['username']; $pass= $_POST['password']; if($user && $pass){ $sql = "SELECT * FROM `users` WHERE `username`='$user'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 1){ $epass = md5($password); $sql2 = "SELECT * FROM `users` WHERE `username` ='$user' AND `password`='$epass'"; $res2 = mysql_query($sql2) or die(mysql_error()); }else { echo "USERNAME OR PASSWORD INCORRECT\n"; } }else { echo "USERNAME OR PASSWORD INCORRECT\n"; } } } ?> Quote Link to comment Share on other sites More sharing options...
ram4nd Posted August 28, 2009 Share Posted August 28, 2009 if ($_SESSION['uid']){ use isset or empty Quote Link to comment Share on other sites More sharing options...
dachshund Posted August 28, 2009 Author Share Posted August 28, 2009 like this? if (isset($_SESSION['uid'])){ that returns the same result. Quote Link to comment Share on other sites More sharing options...
ReKoNiZe Posted August 28, 2009 Share Posted August 28, 2009 So when they're logged in you see nothing at all? Not even anything echo'd by the else statement? Quote Link to comment Share on other sites More sharing options...
lynxus Posted August 28, 2009 Share Posted August 28, 2009 just my 2c, Check your http server error logs. This may show you something you have missed. 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.