js版的防范SQL注入式攻击代码:

Posted on 2007-05-31 17:51 my 阅读(360) 评论(0)  编辑  收藏 所属分类: 脚本
js版的防范SQL注入式攻击代码:
  
<script language="javascript">
<!--
 var url = location.search;
 var re=/^\?(.*)(select%20|insert%20|delete%20from%20|count\(|drop%20table|update%20truncate%20|asc\(|mid\(|char\(|xp_cmdshell|exec%20master|net%20localgroup%20administrators|\"|:|net%20user|\|%20or%20)(.*)$/gi;
 var e = re.test(url);
 if(e) {
  alert("地址中含有非法字符~");
  location.href="error.asp";
 }
//-->
<script>

只有注册用户登录后才能发表评论。


网站导航:
 

posts - 63, comments - 45, trackbacks - 0, articles - 99

Copyright © my