http://php.flashwebhost.com/sibichan..._password.html
Yes, I got the mail with password
I used 'require' in lost_password.php
PHP Code:
<?php
require "includes/database.php";
if (isset($_POST['email'])) {
$email = $_POST['email'];
} else {
die('Please enter your email address');}
// now we have $email variable.
// $email can contain space if user enter white space..
// So lets remove any white space char using trim() function.
$email = trim($email);
// lets write an SQL statement to search our users table
// to find the user having email address == $email
$sql = "select * from users where email='$email'";
// In above line, we used single quotes between email, because it is a string.
// Now time to execute the SQL statement.
$result = $mysqli->query($sql);
// lets see how many records found in database
// If num_rows is 0, no user found
if ($result->num_rows == 0) {
die("User with email address <b>$email</b> not found");
}
// lets get the user record from MySQLi result
$userInfo = mysqli_fetch_assoc($result);
// $userInfo is an associate array.
// Lets print it.
// Now you can see all information about the user, including password.
$name = $userInfo['name'];
$password = $userInfo['password'];
mail($email,"Your password", "Hello $name, your password is $password");
echo 'The password has been sent to the e-mail address specified';
Bookmarks