<?php
$servername = "localhost";
$username = "aradhayasafetynets";
$password = "Kmk[I4#Wz;*#";
$db_name = "aradhayasafetynets";  
$conn = new mysqli($servername, $username, $password, $db_name);
if($conn->connect_error){
    die("Connection failed".$conn->connect_error);
}
echo " ";
if (isset($_POST['submit'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];

    $sql = "select * from user where username = '$username' and password = '$password'";  
    $result = mysqli_query($conn, $sql);  
    $row = mysqli_fetch_array($result, MYSQLI_ASSOC);  
    $count = mysqli_num_rows($result);  
    
    if($count == 1){  
        header("Location: blog.php");
    }  
    else{  
        echo  '<script>
                    window.location.href = "index.php";
                    alert("Login failed. Invalid username or password!!")
                </script>';
    }     
}
?>



