This commit is contained in:
Flatlogic Bot 2025-11-05 08:41:20 +00:00
parent 9bc03d5115
commit 466e6355cc

View File

@ -19,10 +19,11 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($user) {
$token = bin2hex(random_bytes(50));
$expires = date("U") + 1800; // 30 minutes
$expires_timestamp = time() + 1800; // 30 minutes
$expires_datetime = date('Y-m-d H:i:s', $expires_timestamp);
$stmt = $pdo->prepare("INSERT INTO password_resets (email, token, expires) VALUES (?, ?, ?)");
$stmt->execute([$email, $token, $expires]);
$stmt = $pdo->prepare("INSERT INTO password_resets (email, token, expires_at) VALUES (?, ?, ?)");
$stmt->execute([$email, $token, $expires_datetime]);
$reset_link = "http://" . $_SERVER['HTTP_HOST'] . "/reset_password_form.php?token=" . $token;