Login JSP Page
<%
String login = request.getParameter("login");
String password = request.getParameter("password");
if ( login.equals("admin") && password.equals("guess") ) {
// Valid login
session.setAttribute("authorized", "yes");
} else {
// Invalid login
session.setAttribute("authorized", "no");
}
%>
Login Confirmation
You logged in with <%= login+"/"+password %>
See the secret
The Secret Page
Welcome
Here is the secret
The Code Protecting The Secret
<%
String authorized = (String)session.getAttribute("authorized");
if ( authorized.equals("no") ) {
%>
<%
}
%>
0 意見:
張貼留言