Note that there are some explanatory texts on larger screens.

plurals
  1. POLog in returns blank for incorrect password?
    primarykey
    data
    text
    <p>I have been using a tutorial for a registration and log in page. Everything is perfect except when a user inputs an incorrect password. </p> <p>If no password is entered then the stated error is displayed fine.</p> <p>If the correct password is entered it logs them in. </p> <p>If the incorrect password is entered it goes to a blank page?!</p> <p>I want an incorrect password to display a message just like when the wrong username is entered. I've included my entire <code>login.php</code> code:</p> <pre><code>include('db.php'); if(!isset($_POST['login'])) { include('form.php'); } else { if(isset($_POST['user'])&amp;&amp;$_POST['user']==""||!isset($_POST['user'])) { $error[] = "Username Field can't be left blank"; $usererror = "1"; } if(!isset($usererror)) { $user = mysql_real_escape_string($_POST['user']); $sql = "SELECT * FROM users WHERE user = '$user'"; if(mysql_num_rows(mysql_query($sql))=="0") { $error[] = "Can't find a user with this username"; } } if(isset($_POST['pass'])&amp;&amp;$_POST['pass']==""||!isset($_POST['pass'])) { $error[] = "password Field can't be left blank"; } if(isset($error)) { if(is_array($error)) { echo "&lt;div class=\"error\"&gt;&lt;span&gt;please check the errors and refill the form&lt;span&gt;&lt;br/&gt;"; foreach ($error as $ers) { echo "&lt;span&gt;".$ers."&lt;/span&gt;&lt;br/&gt;"; } echo "&lt;/div&gt;"; include('form.php'); } } if(!isset($error)) { $suser=mysql_real_escape_string($_POST['user']); $spass=md5($_POST['pass']);//for secure passwords $find = "SELECT * FROM users WHERE user = '$suser' AND password = '$spass'"; if(mysql_num_rows(mysql_query($find))=="1"or die(mysql_error())) { session_start(); $_SESSION['username'] = $suser; header("Location: loggedin.php"); } else { echo "&lt;div class=\"warning\"&gt;&lt;span&gt;Some Error occured durring processing your data&lt;/div&gt;"; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload