<?php
session_start();
include ("db.php");
if(isset($_POST['login'])){
    if(empty($_POST['username']) || empty($_POST['password'])){
        header("Location: index.php?Empty=Empty username or password");
    }else{
        $username = $_POST['username'];
        $password = $_POST['password'];
        $query = mysqli_query($conn, "SELECT * FROM admin WHERE username = '$username' ");
        $pass = mysqli_fetch_assoc($query);

       
        if($pass['password'] === $password) {
            $_SESSION['User'] = $pass['username'];
            header("Location: dashboard.php");
            }else{
                header("Location: index.php?Invalid=Wrong username or password");
            } 
       
    }
}
?>