asp防止垃圾留言代码
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
[p][br][br]<% [br]server_v1=cstr(request.servervariables("http_referer"))[br]response.write(server_v1) [br]server_v2=cstr(request.servervariables("server_name")) [br]if mid(server_v1,8,len(server_v2))<>server_v2 then [br]response.write "禁止外部提交数据" [br]response.end [br]end if[/p]
[p]if len(request.form("frmcontent"))>1000 then [br]response.write "输入内容超过规定字符数目" [br]response.end [br]end if[/p] [p]if request.cookies("visitime")<>"" then [br]if datediff("s",request.cookies("visitime"),now())<60 then [br] response.write "请勿在1分钟内重复提交评论" [br] response.end [br]end if [br]end if[/p] [p][br]count="六合彩,免费电影,安利,http,www" [br]connts = split(connt,",") [br]for each glword in connts [br]if instr(request.form("frmcontent"),glword)<>0 then [br]response.write "该关键字已被过滤" [br]response.end [br]end if [br]next[/p] [p]dim usernam,comments[br]dim fieldlist,valuelist[br]username = request.form("username")[br]comments = request.form("comments")[br]newsid = request.form("newsid")[br]if username = "" or comments = "" then [br]response.write("姓名或者内容没有填写")[br]response.end()[br]end if[br]fieldlist = array("username","comments","newsid")[br]valuelist = array(username,comments,newsid)[br]set objrs = server.createobject("adodb.recordset")[br]objrs.open "feedback",objconn,1,2[br]objrs.addnew fieldlist,valuelist[br]closei()[br]response.cookies("visitime")=now() [br]response.redirect(server_v1)[br]%>[/p] 该文章在 2010/7/3 14:09:30 编辑过 |
关键字查询
相关文章
正在查询... |