• <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        當(dāng)前位置:雨林木風(fēng)下載站 > 技術(shù)開(kāi)發(fā)教程 > 詳細(xì)頁(yè)面

        所有方面測(cè)試email的有效果性

        所有方面測(cè)試email的有效果性

        更新時(shí)間:2022-04-27 文章作者:未知 信息來(lái)源:網(wǎng)絡(luò) 閱讀次數(shù):

        一般我們常希望拜訪你的網(wǎng)站的朋友能留下Email  
        但是很多人都會(huì)隨便打,造成管理員的困擾,  
        以下這個(gè)class可以線上檢查Email是否是有效的Email(存不存在)  

        <?  
        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);  
        }  

        Function ValidateEmailHost($email,$hosts=0)  
        {  
        if(!$this->VerifyRule($email))  
        return(0);  
        $user=strtok($email,"@");  
        $domain=strtok("");  
        if(GetMXRR($domain,&$hosts,&$weights))  
        {  
        $mxhosts=array();  
        for($host=0;$host<count($hosts);$host++)  
        $mxhosts[$weights[$host]]=$hosts[$host];  
        KSort($mxhosts);  
        for(Reset($mxhosts),$host=0;$host<count($mxhosts);Next($mxhosts),$host++)  
        $hosts[$host]=$mxhosts[Key($mxhosts)];  
        }  
        else  
        {  
        $hosts=array();  
        if(strcmp(@gethostbyname($domain),$domain)!=0)  
        $hosts[]=$domain;  
        }  
        return(count($hosts)!=0);  
        }  

        Function VerifyResultLines($connection,$code)  
        {  
        while(($line=$this->GetLine($connection)))  
        {  
        if(!strcmp(strtok($line," "),$code))  
        return(1);  
        if(strcmp(strtok($line,"-"),$code))  
        return(0);  
        }  
        return(-1);  
        }  

        Function VerifyOnline($email)  
        {  
        if(!$this->ValidateEmailHost($email,&$hosts))  
        return(0);  
        if(!strcmp($localhost=$this->localhost,"")  
        && !strcmp($localhost=getenv("SERVER_NAME"),"")  
        && !strcmp($localhost=getenv("HOST"),""))  
        $localhost="localhost";  
        if(!strcmp($localuser=$this->localuser,"")  
        && !strcmp($localuser=getenv("USERNAME"),"")  
        && !strcmp($localuser=getenv("USER"),""))  
        $localuser="root";  
        for($host=0;$host<count($hosts);$host++)  
        {  
        if(($connection=($this->timeout ? fsockopen($hosts[$host],25,&$errno,&$error,$this->timeout) : fsockopen($hosts[$host],25))))  
        {  
        if($this->VerifyResultLines($connection,"220")>0  
        && $this->PutLine($connection,"HELO $localhost")  
        && $this->VerifyResultLines($connection,"250")>0  
        && $this->PutLine($connection,"MAIL FROM: <$localuser@$localhost>")  
        && $this->VerifyResultLines($connection,"250")>0  
        && $this->PutLine($connection,"RCPT TO: <$email>")  
        && ($result=$this->VerifyResultLines($connection,"250"))>=0)  
        {  
        fclose($connection);  
        return($result);  
        }  
        fclose($connection);  
        }  
        }  
        return(-1);  
        }  

        function Verify($email,$type=0) {  
            if($type==0) return $this->VerifyRule($email) ;  
            else     return $this->VerifyOnline($email) ;  

        }  

        };      
              
              
        ?>  


        用法:  
        $m=new CEmail;  
        //僅檢查語(yǔ)法  
        if($m->Verify("jerry@mail.jerry.com.tw",0)) echo "有效";  
        else echo "無(wú)效";  

        //線上檢查是否真的有該Email  
        if($m->Verify("jerry@mail.jerry.com.tw",1)) echo "有效";  
        else echo "無(wú)效";  

        溫馨提示:喜歡本站的話,請(qǐng)收藏一下本站!

        本類教程下載

        系統(tǒng)下載排行

        主站蜘蛛池模板: 免费v片视频在线观看视频| 日韩av无码成人无码免费| 亚洲精品专区在线观看| 无码天堂va亚洲va在线va| 在线观着免费观看国产黄| 亚洲av永久中文无码精品| 美女被免费视频网站a国产| 亚洲人成网站在线在线观看| 国产片免费在线观看| 国产成人精品久久亚洲高清不卡| 最近免费中文字幕大全视频| 亚洲色欲啪啪久久WWW综合网| 精品国产免费观看| 人人鲁免费播放视频人人香蕉| 亚洲成a人片在线观看老师| 中国一级毛片视频免费看| 精品亚洲一区二区| 日本免费xxxx色视频| 亚洲成熟丰满熟妇高潮XXXXX| 四虎影视精品永久免费| 精品无码一级毛片免费视频观看| 精品亚洲综合久久中文字幕| 成年人网站免费视频| 欧美激情综合亚洲一二区| 红杏亚洲影院一区二区三区| 日本一卡精品视频免费| 亚洲日韩看片无码电影| 国产精品亚洲综合一区| 999任你躁在线精品免费不卡| 亚洲综合色区中文字幕| 亚洲成a人片在线观看日本麻豆 | 免费国产午夜高清在线视频| 精品亚洲国产成AV人片传媒| 在线免费不卡视频| 免费一区二区无码东京热| 亚洲中文久久精品无码1| 2022中文字字幕久亚洲| 免费专区丝袜脚调教视频| 色噜噜狠狠色综合免费视频 | 皇色在线视频免费网站| 污污污视频在线免费观看|