Code Fixed, Mail received with password.
PHP Code:
<?php
if (isset($_POST['email'])) { $email = $_POST['email'];} else { die('Please enter your email address');}
$email = trim($email);
$db_server = '127.0.0.1';$db_user = 'fwhphp_user';$db_password = 'k5BJRaX6SFbs';$db_name = 'fwhphp_db';
$mysqli = new mysqli($db_server, $db_user, $db_password, $db_name);
if ($mysqli->connect_errno) { echo 'Connect failed: ' . $mysqli->connect_error; exit();}
$sql = "select * from users where email='$email'";
$result = $mysqli->query($sql);
if ($result->num_rows == 0) { die("User with email address <b>$email</b> not found");}
$userInfo = mysqli_fetch_assoc($result);
$name = $userInfo['name'];$password = $userInfo['password'];mail($email,"Your password", "Hello $name, your password is $password");
echo 'New Password send to your email';
Bookmarks