|  | 
 
| 用这个小插件可以防止留言板被垃圾信息注入
 
 第一步,下载  code_s.asp
  code_s.asp
(1.37 KB, 下载次数: 265)
 放到网站根目录 第二步,打开 /book.asp 在 <!--#include file="inc/Yidacms.page.asp" --> 下面 添加一行 <!--#include file="code_s.asp" -->
 第三步,
 
 找到
 
 If Trim(Request.Form("validatecode"))=Empty Or Trim(Session("cnbruce.com_ValidateCode"))<>Trim(Request.Form("validatecode")) Then
 response.write("<script language=javascript> alert('"&lang(3)&"');history.back(-1);</script>")
 response.end
 end if
 
 
 改成
 
 if len(trim(request.Form("huida"))) < 1 then
 response.write ("<script language=javascript> alert('"&lang(3)&"');history.back(-1);</script>")
 response.end
 end if
 Dim postgo : postgo = trim(request.Form("wenti")) & "=" & trim(request.Form("huida"))
 if instr(problemcode,postgo) < 1 then
 response.write("<script language=javascript> alert('回答出错啦!');history.back(-1);</script>")
 response.end
 end if
 
 
 找到
 
 function Book(a)
 Book = replace(a,"{yidacms:book}",tBook())
 end function
 
 
 改成
 
 function Book(a)
 a = replace(a,"{yidacms:book}",tBook())
 a = replace(a,"{Yidacms:codeshow}",showcode)
 Book = a
 end function
 
 
 第四步,打开模板文件 zh_book.html 修改如下代码
 把
 <tr>
 <td>
 (*)验证码
 </td>
 </tr>
 <tr>
 <td>
 <img src='/inc/validatecode.asp' align='absmiddle' border='0' width='70' height='22' class='yanimg'><input name='validatecode' type='text' class="yan">
 </td>
 <td>
 <div align="right">
 <input type='hidden' name='shuaiweb_language' value='ch'/><input type="submit" name="Submit" value="提交留言" class="inanniu"/>
 </div>
 </td>
 </tr>
 
 
 注意HTML代码的闭合
 修改成
 
 {Yidacms:codeshow}
 
 您可以通地  code_s.asp 来设置提问和回答答案,请多设置问题和答案,系统会自动随机生成。增加安全性。
 
 完成!~
 
 
 | 
 |