///////检验email合法性//////
if ($email)
{
$error_email=true;
$point_right=strrpos($email,".");
$point_left=strpos($email,".");
$email_len=strlen($email);
$a_left=strpos($email,"@");
$a_right=strrpos($email,"@");
$cha=$point_left-$a_left;
if ($email_len-$point_right<5 && $email_len-$point_right>2 && $point_left>3 && $a_left==$a_right && $a_left>0 && $cha>1)
{
$error_email=false;
}
if ($error_email)
{
echo "
<html>
<head>
<title>Email输入错误</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="refresh" content="3;URL=gb.php">
</head>
<body bgcolor=#3366CC>
<p>
<center><h2><font color=white>Email输入不合法,3秒钟之后将自动返回留言板。<br>到时请重新输入正确的Email,谢谢!<br></font></h2></center><p>
</body></html>";
exit;
}}
///////检验email合法性//////校验条件:
1、该email中,最少有一个"."且,最后一个"."的后面应有2或3个字符。
2、该email中,只能有一个"@"(最前面的@=最后面的@)。
3、第一个@和第一个.之间最少有一个字符。
4、@不能是开头的字符。
5、.最少要在4位以后。就是说要在 X@X.之后。
满足以上条件的,才能合格,当然,还有其它的条件,只是我没想到。
/cut/
|