mysql - Having issue in my if condition in my php code -


i want when user click login button , inputs empty echo please enter email , password , if user put email , password wrong echo incorrect email , password .

my problem when click login button , inputs empty echo both please enter email , password , incorrect email , password.

i want echo please enter email , password if both email , password empty , if 1 of email or password wrong should echo incorrect email , password.

<?php  require 'encryption.php'; include_once('database.php');  $db = new connection(); $db = $db->dbconnect(); $db->setattribute(pdo::attr_emulate_prepares, false);  $email = $_post['email']; $pass = $_post['password'];  $hash_cost_log2 = 8; $hash_portable = false; $hasher = new passwordhash($hash_cost_log2, $hash_portable); $hash = '*';  $login = $db->prepare("select user_password tbl_user user_email= :email"); $login->bindparam(':email', $email, pdo::param_str); $login->execute(); $hash = $login->fetchcolumn();      if(empty($email) && empty($pass)){       echo "please enter email , password";     }     if($hasher->checkpassword($pass, $hash))     {         $st = $db->prepare("select * tbl_user user_email=? , user_password=? , user_active='1'");         $st->bindparam(1, $email, pdo::param_str);         $st->bindparam(2, $hash, pdo::param_str);         $st->execute();          if($st->rowcount() === 1){             echo "1";             exit;         }     }else{         echo "incorrect email or password";       }   ?> 

change second if elseif.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -