I am try to figure out how to check current time against time in database and header the user to "expired page" if the current time is greater than the one in database "1 hour"
$email = $token = $check_time = "";
$crossToken = $db->prepare("SELECT email, token, check_time FROM pw_reset_company WHERE token=? LIMIT 1");
$crossToken->bind_param('s', $c);
if ($crossToken->execute()) {
$crossToken->bind_result($email, $token, $check_time);
$crossToken->store_result();
$rowCount = $crossToken->num_rows;
if ($crossToken->fetch()) {
$contactEmail = $email;
$timeToExpire = $check_time;
}
if ($rowCount > 0) {
date_default_timezone_set("UTC");
$checkTime = date("H:i:s", time());
if($timeToExpire>$checkTime){
header("Location:?pid=expired");
}
?>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
<label for="password">Enter New Password</label>
<input type="password" name="password" id="password">
<label for="confirm">Enter New Password</label>
<input type="password" name="confirm" id="confirm">
<input type="submit" name="subNewPass" id="subNewPass" value="Reset Password">
</form>
<?php
} elseif ($_GET['c'] && !(empty($_GET['c']))) {
header("Location:?pid=expired");
}
}