D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
proc
/
thread-self
/
root
/
home
/
markniuj
/
bazmeasar.com
/
admin
/
Filename :
reset_password.php
back
Copy
<?php include "../config.php"; ?> <?php session_start(); // Check if the reset code is set in the URL if (isset($_GET['code'])) { $resetCode = $_GET['code']; // Check if the code exists in the database $stmt = $conn->prepare("SELECT * FROM password_reset WHERE reset_code = ? AND expires_at > NOW()"); $stmt->bind_param("s", $resetCode); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { // Code is valid, allow the user to reset the password $row = $result->fetch_assoc(); $email = $row['email']; // Display the password reset form ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Password Reset</title> <!-- Add your CSS styling here --> </head> <body> <h2>Reset Your Password</h2> <!-- Add your password reset form here --> <form action="process_reset_password.php" method="post"> <input type="hidden" name="email" value="<?php echo $email; ?>"> <label for="new_password">New Password:</label> <input type="password" name="new_password" required> <label for="confirm_password">Confirm Password:</label> <input type="password" name="confirm_password" required> <button type="submit">Reset Password</button> </form> </body> </html> <?php } else { // Code is invalid or expired echo "Invalid or expired reset code."; } // Close the database connection $stmt->close(); $conn->close(); } else { // Code is not set, redirect to the login page or show an error message header("Location: login.php"); exit(); } ?>