Please describe the issue you're having
If you accept the answer, please mark the topic as [SOLVED] by clicking the tick.

Moderators: RussH, cptr13

Forum rules: Just please remember to play nicely once you walk through the door. You can disagree with us, or any other commenters in this forum, but respect our space and keep your comments directed to the topic at hand.
#5885
stephenyork wrote: 15 Nov 2024, 04:37
Code: Select all
PHP
<?php
// ... (Database connection and other setup)

// Handle password reset request
if (isset($_POST['email'])) {
    $email = $_POST['email'];

    // Check if the email exists in the database
    $user = getUserByEmail($email);

    if ($user) {
        // Generate a reset token
        $token = generateRandomToken();

        // Update the user's record with the token
        updateUserToken($user['id'], $token);

        // Send a reset password email
        sendEmail($user['email'], $token);

        // Redirect to a success page or display a message
        header('Location: password-reset-success.php');
        exit;
    } else {
        // Handle invalid email address
        // ...
    }
}

// Password reset page
if (isset($_GET['token'])) {
    $token = $_GET['token'];

    // Validate the token
    $user = getUserByToken($token);

    if ($user) {
        // Display a form for the user to enter a new password
        // ...
    } else {
        // Handle invalid token
        // ...
    }
}

// ... (Other functions for database operations, email sending, etc.)
idk if this is what you looking for but eh..hope this helpgetaway shootout
I tried this code and it works fine, many thanks.
Other Hosting Options?

CarX Street Mod APK delivers an immersive open-wor[…]

Hey @RedCat, this sounds simply as though your I[…]

Hi Russ, please can you assist when you're able to[…]

Hi, how does the &quot;contains&quot; fi[…]