asp防止垃圾留言代码
|
admin
2010年7月3日 14:9
本文热度 6383
|
<%
server_v1=cstr(request.servervariables("http_referer"))
response.write(server_v1)
server_v2=cstr(request.servervariables("server_name"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
response.write "禁止外部提交数据"
response.end
end if
if len(request.form("frmcontent"))>1000 then
response.write "输入内容超过规定字符数目"
response.end
end if
if request.cookies("visitime")<>"" then
if datediff("s",request.cookies("visitime"),now())<60 then
response.write "请勿在1分钟内重复提交评论"
response.end
end if
end if
count="六合彩,免费电影,安利,http,www"
connts = split(connt,",")
for each glword in connts
if instr(request.form("frmcontent"),glword)<>0 then
response.write "该关键字已被过滤"
response.end
end if
next
dim usernam,comments
dim fieldlist,valuelist
username = request.form("username")
comments = request.form("comments")
newsid = request.form("newsid")
if username = "" or comments = "" then
response.write("姓名或者内容没有填写")
response.end()
end if
fieldlist = array("username","comments","newsid")
valuelist = array(username,comments,newsid)
set objrs = server.createobject("adodb.recordset")
objrs.open "feedback",objconn,1,2
objrs.addnew fieldlist,valuelist
closei()
response.cookies("visitime")=now()
response.redirect(server_v1)
%>
该文章在 2010/7/3 14:09:30 编辑过