<?php
$email = $_POST["email"];
$email_test = eregi("^([A-Za-z0-9_-]+)(\.[A-Za-z0-9_-]+)*@([A-Za-z0-9_-]\.)*([A-Za-z0-9_-]+)\.[A-Za-z]{2,}$", $email);
if($email_test){
include("db.inc.php"); //FILE WITH THE IMPORTANT MySQL INFORMATION
$server_un = 'ddagar251'; //USERNAME OF YOUR WEBSITE EMAIL ADDRESS (CHANGE TO YOUR OWN) Ex: admin
$domain = $_SERVER["gmail.com"]; //DOMAIN NAME WITH EXTENSION; Ex: (wcetdesigns.com)
$server_email = $server_un.'@'.$domain; //YOUR WEBSITE'S EMAIL ADDRESS
$query = mysql_qenter code hereuery("SELECT * FROM register WHERE email='".$email."'");
$numrow = mysql_num_rows($query);
$result = mysql_fetch_assoc($query);
if($numrow&&$result["email"]){
$to = $email;
$subject = "Forgot Password";
$headers = "From: Your Site <".$server_email.">\r\n";
$headers .= "Content-type: text/html\r\n";
$message = "You have requested that you forgot your password.<br>
Password: <b>".$result["password"]."<b>";
mail($to, $subject, $message, $headers);
echo 'Password sent to <b>'.$email.'</b>';
}
} else {`enter code here`
echo 'Invalid Email';
}
?>
答案 0 :(得分:0)
使用preg_match而不是像这样的eregi:
$email_test = preg_match("/^([A-Za-z0-9_-]+)(\.[A-Za-z0-9_-]+)*@([A-Za-z0-9_-]\.)*([A-Za-z0-9_-]+)\.[A-Za-z]{2,}$/i", $email);