We often hope that friends who visit your website can leave an email.
But a lot of people are going to fight, causing the manager to bother,
The following class can be used to check whether email is valid or not.
?
Class Cemail {
var $email _regular_expression= "^" ([a-z0-9_]|\-|\.) +@ (([a-z0-9_]|\-) +\.) +[a-z]{2,4}$ ";
var $timeout = 0;
var $localhost = "";
var $localuser = "";
Function getline ($connection)
{
for ($line = "";;)
{
if (feof ($connection))
return (0);
$line. =fgets ($connection, 100);
$length =strlen ($line);
if ($length >=2
&& substr ($line, $length -2,2) = = "RN")
Return (substr ($line, 0, $length-2));
}
}
Function putline ($connection, $line)
{
Return (Fputs ($connection, "$linern"));
}
Function Verifyrule ($email)
{
Return (eregi ($this->email_regular_expression, $email)!=0);
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.