mysql - PHP script reports wrong credentials -


ok, code authentication. now, have 1 table , 5 php working scripts except one. after successful login, user should redirected home page, problem is, php echoes "cannot login" error message regardless of login details. heres script:

session_start(); include_once'dbconnect.php';     if (isset($_session['user']) != "") {         header ("location: home.php");       }      if (isset($_post['login'])) {         $email = mysql_real_escape_string($_post['email']);         $pass = mysql_real_escape_string($_post['pass']);         $sql = mysql_query("select * users email='".$email."'");         $num = mysql_fetch_assoc($sql);              if ($num['password'] == $pass)) {                 $_session['user'] = $num['user_id'];                 header ("location: home.php");             }                 else {                     echo "cannot login";                 }     } 

any hints ? thank you

session_start(); include_once'dbconnect.php';     if (isset($_session['user']) != "") {         header ("location: home.php");       }      if (isset($_post['login'])) {         $email = mysql_real_escape_string($_post['email']);         $pass = mysql_real_escape_string($_post['pass']);         $sql = mysql_query("select * users email='".$email."'");         $num = mysql_fetch_assoc($sql);         if(count($num)>0){             if ($num['password'] == $pass)) {                 $_session['user'] = $num['user_id'];                 header ("location: home.php");             }                 else {                     echo "cannot login";                 }         }else{           echo "cannot login, email id not found";         }      } 

make sure getting password data base.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -