<?php 

$dir = '../';

require_once $dir.'includes/main.php';

$errors = array();

$email = clean($_POST['email']);
$password = clean($_POST['password']);

$password = sha1($password);

$sql = "SELECT * FROM users WHERE email = '{$email}' AND password = '{$password}' LIMIT 1";

if(fetch_rows($sql) < 1){

   ex_messages(['The email address and password you entered are incorrect. Please try again']);

}else{

   setcookie('email', $email, $t + (60*60*24*30*12), '/');
   setcookie('password', $password, $t + (60*60*24*30*12), '/');

   ex_redirect("dashboard");

}

?>