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 編輯過 |
關鍵字查詢
相關文章
正在查詢... |