Login

if(isset($_POST)){ $username = mysqli_real_escape_string($conn, $_POST['username']); $sql = "SELECT * FROM `login` WHERE username = '$username'"; $result = mysqli_query($conn,$sql); $count = mysqli_num_rows($result); if($count == 1){ echo "Send email to user with password"; }else{ echo "User name does not exist in database"; } } $r = mysqli_fetch_assoc($result); $password = $r['password']; $to = 'to: [email protected]' . "\r\n". $subject = "Thank you for enquiry"; $message = "Please use this password to login " . $password; // Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers $headers .= 'From: [email protected]' . "\r\n". "CC: [email protected]"; mail($to,$subject,$message,$headers); ?> Forgot your password?
To Top