samedi 9 janvier 2021

normal username and password not working in if condition

my problem is when normal user input his correct name and password, he is not able to login.

` $sql = "select * from login where 'username' ='$username' && 'password' ='$password'"; $result = mysqli_query($conn,$sql); $data=mysqli_fetch_assoc($result);

if(isset($_POST['submit'])) {

$username=$_POST['username'];
$password=$_POST['pwd'];
$usernames=$data['username'];
$passwords=$data['password'];
$admin="admin";
$pass="admin123";


if($username==$data['username'])
{
    $_SESSION['username']=$_POST['username'];  
    echo "<script> window.location.href='status.php';</script>";

   exit();
   
   
}


if($username==$admin&&$password==$pass)
{
  $_SESSION['admin']=$admin; 
  $_SESSION['pass']=$pass;
  
  echo "<script> window.location.href='display.php';</script>";
  exit();
} 

}
`

Aucun commentaire:

Enregistrer un commentaire