<?php
     session_start();
     
     include("./bd/conexao.php");
     
     

    
 

    $email        = $_POST['email'];

    $password     = $_POST['password'];

    

    if(isset($_POST['acao'])&& $_POST['acao'] == 'fazer_login'){

       if($email == "" && $password == ""){

           echo "<script>alert('Os Compos NÃ£o Podem Ficar Vazios'); location.href='index.php'</script>";

    }else{

        $selectLogin = $link->query("SELECT * FROM usuarios WHERE email = '$email' AND password = '$password'");

         

        if(mysqli_num_rows($selectLogin)> 0){

            $_SESSION['email'] = $email;

            $_SESSION['password']   = $password;

            echo "<script>location.href='admin.php'</script>";

        }else{

            echo "<script>alert('Login Incorreto!!!'); location.href='index.php'</script>";

        }

    }  

    } 

    
  
?>
