why sign in is NOT failing?!

why sign in is NOT failing?!

Hi,

I am using simple sign in form with Jquery and PHP but my problem that everytime I enter anything in the email and password it accepts even if does not exist! below my jquery and PHP as well and the url is:



My Page:
  1. <!DOCTYPE html>
  2. <html manifest="cache.manifest">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Welcome to Smashburger</title>
  6.     <?php include './includes/meta.php'; ?>
  7.     <link rel="stylesheet" href="css/signin.css">
  8. </head>
  9. <body style="background: url(images/homepage.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;">
  10. <span class="button" id="toggle-login">Log in</span>
  11. <div id="login">
  12.   <div id="triangle"></div>
  13.   <div id="divLogin">
  14.   <h1>Sign in</h1>
  15.   <form id="login-form" name="login-form">
  16.     <input type="email" id="txtSigninEmail" name="txtSigninEmail" placeholder="Email" />
  17.     <input type="password" id="txtSigninPassword" name="txtSigninPassword" placeholder="Password" />
  18.     <div style="text-align:center"><img id="imgLoading" src="images/signin_loading.gif" style="display: none;" alt="Please wait"></div>
  19.     <input type="button" id="btnLoginNow" name="btnLoginNow" value="Sign in" /><br><br>
  20.     <input type="button" id="btnRegister" name="btnRegister" value="Sign up Now" />
  21.   </form>
  22.   </div>
  23.   <div id="divRegister" style="display: none;">
  24.   <h1>Sign up</h1>
  25.   <form>
  26.     <input type="email" placeholder="First Name" />
  27.     <input type="email" placeholder="Last Name" />
  28.     <input type="email" placeholder="Email" />
  29.     <input type="password" placeholder="Password" />
  30.     <input type="button" id="btnRegisterNow" name="btnRegisterNow" value="Sign up" /><br><br>
  31.     <input type="button" id="btnLogin" name="btnLogin" value="Sign in" />
  32.   </form>
  33.   </div>
  34. </div>
  35.     <?php include './includes/jquery.php'; ?>
  36. <script src="jQueryAssets/index.js"></script>

  37. <script type="text/javascript">
  38. $(document).ready(function()
  39. {
  40.     $('#btnRegister').click(function()
  41. {
  42. $('#divLogin').hide();
  43. $('#divRegister').show();
  44. });

  45.     $('#btnLogin').click(function()
  46. {
  47. $('#divRegister').hide();
  48. $('#divLogin').show();
  49. });

  50. $('#btnLoginNow').click(function ()
  51. {
  52. $("txtSigninEmail").prop('disabled', true);
  53. $("txtSigninPassword").prop('disabled', true);
  54. $('#btnLoginNow').hide();
  55. $('#btnRegister').hide();
  56. $('#imgLoading').show();

  57. $.ajax({
  58. type: 'POST',
  59. url: "login.php",
  60. data: $('#login-form').serialize(),
  61. success: function()
  62. {
  63. window.location.href = 'menu';
  64. },
  65. error: function(jq,status,message)
  66. {
  67. window.location.href = '/';
  68. $("txtSigninEmail").prop('disabled', false);
  69. $("txtSigninPassword").prop('disabled', false);
  70. $('#imgLoading').hide();
  71. $('#btnLoginNow').show();
  72. }
  73. });
  74. });
  75. });
  76. </script>
  77. </body>
  78. </html>

My PHP:
  1. <?php
  2.     include('includes/php_header.php');
  3.     include($_SESSION["smashburger_absolute_path"] . '/includes/Mobile_Detect.php');
  4. include($_SESSION["smashburger_absolute_path"] . '/includes/password_hash.php');
  5.     include($_SESSION["smashburger_absolute_path"] . '/includes/connect2db.php');
  6. if (isset($_POST["txtLoginName"]))
  7. {
  8.     $login_email = $_POST["txtSigninEmail"];
  9. }
  10. else
  11. {
  12. exit(header("Location: ./"));
  13. }
  14.     $login_password = $_POST['txtSigninPassword'];
  15. $password_salt = get_password_salt($login_email);
  16. $password_hash = hash_password($login_password, $password_salt);

  17.     $mysql_query = $mysql_connection->prepare('CALL sp_signin_customer(:param_email, :param_login_password_salt, :param_login_password_hash, :param_ip_address)');
  18.     $mysql_query->bindParam(':param_email', $login_email, PDO::PARAM_STR);
  19. $mysql_query->bindParam(':param_login_password_salt', $password_salt, PDO::PARAM_STR);
  20.     $mysql_query->bindParam(':param_login_password_hash', $password_hash, PDO::PARAM_STR);
  21. $mysql_query->bindParam(':param_ip_address', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR);
  22.     
  23.     $mysql_query->execute();

  24. if ($mysql_query->rowCount() <= 0)
  25. { exit(header("Location: index.php")); }
  26. while($mysql_row = $mysql_query->fetch())
  27. {
  28. $_SESSION["id"] = session_id();
  29. $_SESSION["timestamp"] = time();
  30. $_SESSION["loggedOn"] = true;
  31. $_SESSION["customer_id"] = $mysql_row["customer_id"];
  32. }
  33. ?>

Thanks,
Jassim Rahma