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.
#5856
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
#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.

adidas Yeezy Boost 350 V2 Casual Shoes adidas Yeez[…]

First of all, thank you for the great work! It's[…]

Adidas Yeezy Boost 350 V2 True Form Yeezy 350 Boo[…]

It's interesting how subtle environment issues can[…]