I'm trying to make a login system, that compares two dates, the actual, and the date in my DB.
Something like:
Dummy tries to log in, today is 04/17/2021 and in the "date" column on the database we have the date 04/16/2021, so he will be not redirected to "Dashboard.php", he will be redirected to "expired.html"
My login code is:
<?php
require("conexao.php");
if(isset($_POST["email"]) && isset($_POST["senha"]) && $conexao != null){
$query = $conexao->prepare("SELECT * FROM usuarios WHERE email = ? AND senha = ?");
$query->execute(array($_POST["email"], $_POST["senha"]));
if($query->rowCount()){
$user = $query->fetchAll(PDO::FETCH_ASSOC)[0];
session_start();
$_SESSION["usuario"] = array($user["nome"], $user["adm"], $user["data"]);
echo "<script>window.location = '../dashboard/index.php'</script>";
}else{
echo "<script>window.location = '../index.html'</script>";
}
}else{
echo "<script>window.location = '../index.html'</script>";
}
?>