-3
<?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';
}

?>
4

1 回答 1

0

像这样使用 eregi 的 preg_match insted:

$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);
于 2013-08-24T04:42:45.140 回答