asp防止垃圾留言代码
2018-09-06 11:37
<!--#includefile=common/conn.asp-->
<!--#includefile=common/sub.asp-->
<%
server_v1=Cstr(Request.ServerVariables(HTTP_REFERER))
Response.Write(server_v1)
server_v2=Cstr(Request.ServerVariables(SERVER_NAME))
ifmid(server_v1,8,len(server_v2))<>server_v2then
response.write禁止外部提交数据
response.end
endif
iflen(request.form(frmContent))>1000then
response.write输入内容超过规定字符数目
response.end
endif
ifDateDiff(s,request.cookies(visitime),now())<60then
response.write请勿在1分钟内重复提交评论
response.end
endif
endif
count=六合彩,免费电影,安利,http,
connts=split(connt,,)
Foreachglwordinconnts
ifinstr(request.form(frmcontent),glword)<>0then
response.write该关键字已被过滤
response.end
endif
next
DimUserNam,Comments
Dimfieldlist,Valuelist
UserName=Request.Form(UserName)
Comments=Request.Form(Comments)
newsid=Request.Form(newsid)
IfUserName=OrComments=Then
Response.Write(姓名或者内容没有填写)
Response.End()
EndIf
fieldlist=array(UserName,Comments,newsid)
valuelist=array(UserName,Comments,newsid)
SetobjRs=Server.CreateObject(ADODB.recordset)
objRs.openFeedback,objConn,1,2
objRs.addnewfieldlist,valuelist
closeI()
response.cookies(visitime)=now()
response.Redirect(server_v1)
%>
上一篇:asp最常用的分页函数