Login failed when using mysql_real_escape_string
<p>I have user registration and login pages in PHP, 
I created users as follows</p>

<p>user id:  user@mail.com
password: \n, \r, \, ', ",</p>

<p>Before insert into Db I used mysql_real_escape_string 
get_magic_quotes_gpc is on, php ver 5.3.16
in my database shows password as \n, \r, \, \', \",</p>

<p>My problem is I couldnt login with user id user@mail.com  pwd \n, \r, \, ', ",</p>

<p>in login page I am using following codes</p>

<pre><code>    $_POST['username'] = mysql_real_escape_string($_POST['username']);
$check = mysql_query("SELECT * FROM userstable WHERE username = '".$_POST['username']."'")or die(mysql_error());
 //Gives error if user dosen't exist
 $check2 = mysql_num_rows($check);
 if ($check2 == 0) {
        $_SESSION['errmsg'] = "Invalid username or password...";
        header("Location: login.php?username=".$_POST['username']);
        exit();
                }
 while($info = mysql_fetch_array( $check ))     
 {
    $_POST['pass'] = stripslashes($_POST['pass']);
    $info['password'] = stripslashes($info['password']);
    $_POST['pass'] = md5($_POST['pass']);

 //gives error if the password is wrong
    if ($_POST['pass'] != $info['password']) {
        $_SESSION['errmsg'] = "Wrong password. Please correct. Or use 'Forgot Password Link to recover password.";
        header("Location: login.php?username=".$_POST['username']);
        exit();
    }
 else 
 {  
}
</code></pre>

<p>Where I missed?</p>
