jsp的防注入代码
来源:互联网 发布:下载床上交友软件 编辑:程序博客网 时间:2024/05/16 11:25
//这里写在一个名为sql_inj.java的文件中
public static boolean sql_inj(String str)
{
String inj_str = "'|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare|;|or|-| |,";//这里的东西还可以自己添加
String inj_stra[] = split(inj_str,"|");
for (int i=0 ; i < inj_stra.length ; i )
{
if (str.indexOf(inj_stra[i])>=0)
{
return true;
}
}
return false;
}
jsp中调用该函数检查是否包函非法字符
<%
sql_inj antihack=new sql_inj()
if(request.getParameter("userID") != null)
userID = request.getParameter("userID").trim();//这里的也一样
if (antihack.sql_inj(userID) || antihack.sql_inj(pwd)){//这里的userid和pwd你改成自己的变量
%>
<Script Language=javascript>alert('参数中包含非法字符!');history.back(-1);</Script>" ;
<%
}else{
//这里把正常执行的代码包含进来
}
%>
- jsp的防注入代码
- jsp的防注入代码
- JSP防注入代码
- jsp参数过滤防注入的解决方法
- jsp参数过滤防注入的解决方法
- jsp的防sql注入通用程序
- PHP "完美"的防XSS 防SQL注入的代码
- PHP "完美"的防XSS 防SQL注入的代码
- PHP "完美"的防XSS 防SQL注入的代码
- 我常用的防SQL注入代码
- 简单的 php 防注入代码
- ASP网页防SQL注入的代码
- 360提供的Php防注入代码
- asp 防注入代码
- 防sql注入代码
- php防注入代码
- 网站防注入代码
- PHP防注入代码
- Summary
- 实例化spring容器applicationContext的几种方法
- 最牛B的编码套路
- Apache+Tomcat关于Session Sticky的负载均衡
- javascript新的原生态API
- jsp的防注入代码
- MongoDB Schema Design(MongoDB模式设计)
- 根据数据源获得数据库类型
- Nutch 源码分析 (1)
- ccs的lua库api
- 【经典讨论】STM8L和MSP430的低功耗对比(长期开放)
- SAM9G25开发CORE9G25的心得体会
- 技术创业不能一味追求“骨感”,必要时丰富自己的5个途径
- explainshell:超级强大的Linux命令解释工具