ch1326 Posted April 29, 2010 Share Posted April 29, 2010 Can't figure it out what error is. need help ASAP <?php session_start(); include ("forum.inc"); $links = "<a href = 'main.php'>Click here to proceed to the main page</a><br /><br /><a href = 'enter.php'>Click here to log out.</a>"; if ($user && $pass){ if ($logged_in_user = $user){ setup_page("Already logged in", "Whoops"); l echo "{$user}, You are already logged in. <BR /><BR />"; echo $links; exit; } doConnect() $result = mysql_query("SELECT * FROM user where name = '{$user}' AND password = {$pass} "); if (!$result){ fail("database query failed, login page", true); } if (mysql_num_rows($result)>0){ $record = mysql_fetch_assoc($result); $logged_userID = $record["userID"]; $_SESSION["logged_userID"]; $logged_in_user = $user; $_SESSION["logged_in_user"]; if ($record["mod"]){ $logged_as_mod = true; $_SESSION["logged_as_mod"]; } setup_page("Welcome","Welcome"); echo $links; exit; }else { setup_page("Invalid","Invalid login"); echo "That username-password combination does not appear to match our records. Pleas try again. <BR/><BR/>"; } elseif($user || $pass){ setup_page("Invalid","Invalid login"); echo "Please fill in both fields.<BR/><BR/>"; } else{ setup_page("Login","Login"); echo "Please enter your detail to log in"; } } ?> <form method = 'POST' ACTION = 'login.php'> Your username: <input type = 'text' name = 'user' MAXLENGTH = '20' SIZE = '10'><BR> Your password: <input type = 'password' name = 'password' MAXLENGTH = '10' SIZE = '10'><BR> <input type = 'submit' value = 'Login'> </form> </body> </html> Cheers Quote Link to comment https://forums.phpfreaks.com/topic/200140-need-help-please/ Share on other sites More sharing options...
dreamwest Posted April 29, 2010 Share Posted April 29, 2010 do you get a white screen? I would start by fixing these 2 errors if ($user && $pass){ if ($logged_in_user = $user){ setup_page("Already logged in", "Whoops"); echo "{$user}, You are already logged in. <BR /><BR />"; echo $links; exit; } doConnect(); Quote Link to comment https://forums.phpfreaks.com/topic/200140-need-help-please/#findComment-1050410 Share on other sites More sharing options...
Rustywolf Posted April 29, 2010 Share Posted April 29, 2010 include("forum.inc"); //isnt there a .php at the end of that $result = mysql_query("SELECT * FROM user where name='{$user}' AND password='{$pass}' "); //missing a set of ' Theres also a random l in there. elseif($user || $pass){ setup_page("Invalid","Invalid login"); echo "Please fill in both fields.<BR/><BR/>"; } [/php Should that be this? [code=php:0] elseif(!$user || !$pass){ setup_page("Invalid","Invalid login"); echo "Please fill in both fields.<BR/><BR/>"; } Quote Link to comment https://forums.phpfreaks.com/topic/200140-need-help-please/#findComment-1050446 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.