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.
Help me to Choose Hosting Provider

This part contains practical issues regarding web […]

Hi everyone, I'm using OpenCATS while also managi[…]

Site Backup - PHP Errors

I had a similar problem a while ago, and while loo[…]

Other Hosting Options?

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