Nohtreya Posted October 24, 2006 Share Posted October 24, 2006 [b]H[/b]ello all php´ers!I have an Login script dat works with Sessions and Mysql!But I have one problem:If you enter the username RIGHT but the password WRONG it shows a blank page :SBut if I enter another input it shows the right Error text :SHere is my script:[code]<?phpsession_start();if ($_SESSION['login'] == 1){echo ":: Logged: <b>$naam</b><hr>:: <a href='index.php?page=regist'>Register a customer</a><br>:: <a href='index.php?page=list_klachten'>View list</a><br>:: <a href='index.php?page=logout'>Logout</a><br>";}else{ if($_POST['submit']) { $query = mysql_query("SELECT * FROM helpdesk_login WHERE gebruikersnaam = '".$_POST['username']."'") or die (mysql_error()); $result = mysql_fetch_object($query); $naam = $result->gebruikersnaam; $wachtwoord = $result->wachtwoord; $session_id = $result->type; if(!$_POST['username'] == "$naam" || !$_POST['password'] == "$wachtwoord") { echo "The data are not correctly!<br><br><a href='javascript:history.back(1)'><u>Return</u></a><br><br>"; echo "<br />"; } elseif($session_id == 0) { print "You're account isn't activated yet.<br><br><a href='javascript:history.back(1)'><u>Return</u></a><br><br>"; } else { if($_POST['username'] == "$naam" && $_POST['password'] == "$wachtwoord") { $_SESSION['username'] = $naam; if ($session_id == '1'){ $_SESSION['login'] = "1"; } $_SESSION['naam'] = $naam; echo "Now logged in as: <b>$naam</b><br><br>Click <a href='index.php'>here</a> to continue."; } } } else {?><form name="form1" method="post" action="">Username:<br><input name="username" type="text" /><br><br>Password:<br><input name="password" type="password" /><br><br><input type="submit" name="submit" value="Login" /></form><?}}?>[/code]Thanks in advance ;D 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.