'检测是否有效的E-mail地址
Function IsValidEmail(Email)
Dim names, name, i, c
IsValidEmail = True
Names = Split(email, "@")
If UBound(names) <> 1 Then
IsValidEmail = False
Exit Function
End If
For Each name IN names
If Len(name) <= 0 Then
IsValidEmail = False
Exit Function
End If
For i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 And Not IsNumeric(c) Then
IsValidEmail = false
Exit Function
End If
Next
If Left(name, 1) = "." or Right(name, 1) = "." Then
IsValidEmail = false
Exit Function
End If
Next
If InStr(names(1), ".") <= 0 Then
IsValidEmail = False
Exit Function
End If
i = Len(names(1)) - InStrRev(names(1), ".")
If i <> 2 And i <> 3 Then
IsValidEmail = False
Exit Function
End If
If InStr(email, "..") > 0 Then
IsValidEmail = False
End If
End Function
siteMail="abcd-3@163.com"
Response.Write(IsValidEmail(siteMail))-
asp检测是否有效的E-mail地址函数
[ Asp技术 ]post by 不懂戀愛魚兒 / 2012-4-15 17:08 Sunday -
美化分页样式
[ 网站特效 ]post by 不懂戀愛魚兒 / 2012-4-13 17:01 Friday<style type="text/css"> /* 分页 */ * {font-size:12px; font-family:Arial, Helvetica, sans-serif;} .pages {padding:5px; text-align:center; margin:10px 0; color:#000; clear:both;} .pages select {vertical-align:baseline; +vertical-align:middle; margin:0 0 5px 0;} .pages a{border:1px solid #ddd; text-decoration:none; padding:.2em .65em; *padding:.25em .65em; margin-right:.5em; zoom:1; font-weight:bold; color:#000;} .pages a:link, .pages a:visited{border:1px solid #ddd; text-decoration:none; padding:.2em .65em; *padding:.25em .65em; margin-right:.5em; zoom:1; font-weight:bold; color:#000;} .pages a:hover{background:#0442AB;color:#fff; border:1px solid #0442AB;} .pages span.cpb,.pages span.cpp{border:1px solid #fff; color:#fff; background:#0442AB; text-decoration:none; padding:.2em .65em; *padding:.25em .65em; margin-right:.5em; zoom:1;} </style> <div class="pages"> <div id="MyPage"><a disabled>首页</a> <a disabled>上页</a> <span class="cpb">1</span> <a href="#">2</a> <a href="#">3</a> <a disabled>...</a> <a href="#" class="cpb">下页</a> <a href="#" class="cpb">尾页</a> <a disabled>共有7页</a></div> </div> -
asp检测是否只包含英文和数字、是否有效的数字、用户名等函数
[ Asp技术 ]post by 不懂戀愛魚兒 / 2012-4-11 16:54 Wednesday'检测是否只包含英文和数字 Function IsValidChars(str) Dim re,chkstr Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="[^_\.a-zA-Z\d]" IsValidChars=True chkstr=re.Replace(str,"") if chkstr<>str then IsValidChars=False set re=nothing End Function '检测是否有效的数字 Function IsInteger(Para) IsInteger=False If Not (IsNull(Para) Or Trim(Para)="" Or Not IsNumeric(Para)) Then IsInteger=True End If End Function '用户名检测 Function IsValidUserName(byVal UserName) on error resume next Dim i,c Dim VUserName IsValidUserName = True For i = 1 To Len(UserName) c = Lcase(Mid(UserName, i, 1)) If InStr("$!<>?#^%@~`&*();:-_+='"" ", c) > 0 Then IsValidUserName = False Exit Function End IF Next For Each VUserName in Register_UserName If UserName = VUserName Then IsValidUserName = False Exit For End If Next End Function附件下载:
check.rar 938字节 -
ASP 相关函数(asp防盗链相关函数)防止外部提交
[ Asp技术 ]post by 不懂戀愛魚兒 / 2012-3-15 10:49 Thursday<%'************************************* '防止外部提交 '************************************* function ChkPost() dim server_v1,server_v2 chkpost=false server_v1=Cstr(Request.ServerVariables("HTTP_REFERER")) server_v2=Cstr(Request.ServerVariables("SERVER_NAME")) If Mid(server_v1,8,Len(server_v2))<>server_v2 then chkpost=False else chkpost=True end If end function%> -
Asp相关函数之(asp防盗链下载函数) 二
[ Asp技术 ]post by 不懂戀愛魚兒 / 2012-3-13 10:47 TuesdayASP防盗链输出图片函数 showimg (需要Persits.Jpeg组件支持)
程序代码
Sub showimg(FileName) Response.Clear Dim Jpeg,temp_pic On Error Resume Next Set Jpeg = Server.CreateObject("Persits.Jpeg") If -2147221005=Err then 'Response.write "没有这个组件,请安装!" '检查是否安装AspJpeg组件 downloadFile FileName Exit Sub End If Jpeg.Open (Server.MapPath(FileName)) '打开图片 If err.number then 'Response.write "打开图片失败,请检查路径!" Jpeg.Open (Server.MapPath("images/logos.gif")) response.end End if temp_pic=Jpeg.Binary Response.ContentType = "image/*" Response.AddHeader "Content-Disposition","filename=" & arr_FileName(FileName) Response.BinaryWrite temp_pic Response.End End Sub