<?php
header("Cache-Control: no-cache, must-revalidate");

include 'dbconnect.php';

if(isset($_POST["login"])){
    $username = $conn->real_escape_string(trim($_POST["username"]));
    $password = $conn->real_escape_string(trim($_POST["password"]));

    $sql_login = "SELECT * FROM `user_list`  WHERE username = '$username' AND PASSWORD='$password'";
    $sql_login_execute = $conn->query($sql_login);

    if($sql_login_execute->num_rows>0){
        header('Location:dashboard.php');
    }
    else{
        echo "<script>alert('Login credential wrong'); window.top.location='login.php';</script>";
        //header('Location:login.php');
    }
}
else{
    echo "Give username and password";
}
?>