Viewing File: /home/quiczmwg/solixproperties.org/reset-password.php

<?php
include('_db.php');

$token = $_GET['token'] ?? '';
if (!$token) die("Invalid token.");

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $new_password = password_hash($_POST['password'], PASSWORD_DEFAULT);

    $stmt = $conn->prepare("UPDATE users SET password = ?, reset_token = NULL, reset_expires = NULL WHERE reset_token = ? AND reset_expires > NOW()");
    $stmt->bind_param("ss", $new_password, $token);
    $stmt->execute();

    if ($stmt->affected_rows > 0) {
        echo "Password reset successful!";
    } else {
        echo "Reset link expired or invalid.";
    }
}
?>

<form method="POST">
    <h2>Reset Password</h2>
    <input type="password" name="password" placeholder="Enter new password" required>
    <button type="submit">Reset Password</button>
</form>
Back to Directory File Manager
<