1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

'检查Email地址合法性

本帖由 小叶2005-11-17 发布。版面名称:前端开发

  1. 小叶

    小叶 New Member

    注册:
    2005-09-04
    帖子:
    17,941
    赞:
    33
    PHP:
        Public Function ChkEmail(email)
            
    dim namesnameic
            ChkEmail 
    true
            names 
    Split(email"@")
            if 
    UBound(names) <> 1 then
               ChkEmail 
    false
               
    Exit Function
            
    end if
            for 
    each name in names
                
    if Len(name) <= 0 then
                    ChkEmail 
    false
                    
    exit function
                
    end if
                for 
    1 to Len(name)
                       
    Lcase(Mid(namei1))
                    if 
    InStr("abcdefghijklmnopqrstuvwxyz_-."c) <= and not IsNumeric(cthen
                       ChkEmail 
    false
                       
    Exit Function
                       
    end if
                
    next
                
    if Left(name1) = "." or Right(name1) = "." then
                        ChkEmail 
    false
                     
    Exit Function
                 
    end if
            
    next
            
    if InStr(names(1), ".") <= 0 then
                ChkEmail 
    false
                   
    exit function
            
    end if
            
    Len(names(1)) - InStrRev(names(1), ".")
            if 
    <> and <> 3 then
                   ChkEmail 
    false
                  
    exit function
            
    end if
            if 
    InStr(email"..") > 0 then
                   ChkEmail 
    false
            end 
    if
        
    End Function
     
  2. wm_chief

    wm_chief New Member

    注册:
    2005-09-05
    帖子:
    17,890
    赞:
    46
    还不错
     
  3. 小叶

    小叶 New Member

    注册:
    2005-09-04
    帖子:
    17,941
    赞:
    33
    kao..asp的你看得懂?
     
  4. 老林

    老林 New Member

    注册:
    2005-09-06
    帖子:
    10,580
    赞:
    36
    :D 帝国286