惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
博客园_首页
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
S
Security @ Cisco Blogs
L
LINUX DO - 最新话题
博客园 - 司徒正美
P
Privacy International News Feed
G
Google Developers Blog
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
K
Kaspersky official blog
I
InfoQ
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Webroot Blog
Webroot Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
量子位
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
S
Security Affairs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
S
Security Archives - TechRepublic
V
Visual Studio Blog
T
Troy Hunt's Blog
S
Secure Thoughts
F
Fortinet All Blogs
V
V2EX
The Register - Security
The Register - Security
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - kejian of 20

ResultSet详解 关于e.printStackTrace() Java设计模式之适配器模式 MSSQL 2005转到MSSQL 2000的步骤 - kejian of 20 IIS 一机多站 JavaBean 简单介绍 java.lang.NoClassDefFoundError 关于在Eclipse中导入现有项目 jsp-sql server 2005 关于在ASP中使用在线编辑器——eWebEditor - kejian of 20 mysql简单命令 - kejian of 20 asp连接sqlserver - kejian of 20 JSP页面传递(乱码) - kejian of 20 jsp配置记录(连接MYSQL) - kejian of 20 java连接MYSQL - kejian of 20 服务器端XSLT - kejian of 20 从VCD中提取伴奏 - kejian of 20 不能用 '..' 表示父目录解决方法 - kejian of 20 耳机参数 - kejian of 20
jsp的防sql注入通用程序 - kejian of 20
kejian of 20 · 2007-09-03 · via 博客园 - kejian of 20

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中调用该函数检查是否包函非法字符
 <%
 if(request.getParameter("userID") != null)
    userID = request.getParameter("userID").trim();

  if (StringUtil.sql_inj(userID) || StringUtil.sql_inj(pwd)){
   %>
   <Script Language=javascript>alert('参数中包含非法字符!');history.back(-1);</Script>" ;
   <%
  }else{
  ……
 }%>