I'm creating a system to verify that the user entered the site 1 hour ago or earlier. There is a column in the database that says the last time you logged in. Last_Login (int4) the date has to be in ymdHm format (1703221703).
My problem is that I do not know how I can check this, whether he logged in 1 hour ago or before, or if he is logged in.
My code I've done so far:
public function check_time(){
$date = new \DateTime();
//echo $date->format('ymdHm');
$conexao = new Config;
try{
$conect = $conexao->getConn();
$prepare = $conect->prepare("SELECT * FROM accounts WHERE login = ?");
$prepare->bindvalue(1, $_SESSION['username']);
$prepare->execute();
$dados = $prepare->fetch(PDO::FETCH_ASSOC);
if ($prepare->rowCount() >= 1){
//return $dados['last_login'];
if($dados['last_login'] ==
}
}catch(PDOException $e){
echo "Erro: ".$e->getMessage();
}
}