<?php
session_start();
include "config.php";

if(isset($_POST['login'])){
    $u = $_POST['username'];
    $p = md5($_POST['password']);

    $q = mysqli_query($conn,"SELECT * FROM admin WHERE username='$u' AND password='$p'");
    
    if(mysqli_num_rows($q)){
        $_SESSION['login']=true;
        header("Location: dashboard.php");
    } else {
        echo "Login gagal";
    }
}
?>

<form method="post">
<input name="username" placeholder="Username"><br>
<input name="password" type="password"><br>
<button name="login">Login</button>
</form>