Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%--
- Document : Login
- Created on : 2016-01-23, 15:47:50
- Author : Tomasz
- --%>
- <%@page import="java.util.Random"%>
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <script type="text/javascript" src="jquery-1.11.3.min.js"></script>
- <script type="text/javascript" src="CJS.js"></script>
- <title>Login JSP Page</title>
- </head>
- <body>
- <%
- String username = new String ();
- String pass = new String ();
- String rewrite = new String ();
- String error = new String ("Hello!");
- // Create cookies for first and last names.
- Cookie user = new Cookie("user", request.getParameter("username"));
- //request.getParameter("username"));
- Cookie password = new Cookie("pass", request.getParameter("pass"));
- // Set expiry date after 24 Hrs for both the cookies.
- user.setMaxAge(60*60*24*30);
- password.setMaxAge(60*60*24*30);
- // Add both the cookies in the response header.
- response.addCookie( user );
- response.addCookie( password );
- if (!request.getSession().isNew()) {
- if(request.getSession().equals(rewrite)){
- error="Invalid captcha!";
- //request.getSession().setAttribute("random", rewrite);
- }
- }
- %>
- <!--<form method="GET" action="index.jsp">-->
- <form method="get">
- <strong>Hello Tom!</strong><br/>
- Username: <input type="text" id="username" name="username" value="<%=username%>"><br/>
- Password: <input type="text" id="pass" name="pass" value="<%=pass%>"><br/>
- <input type="submit" value="Save">
- <!--obstawiam że tutaj trzeba dać cookies, żeby wywołać odpowiednią losową liczbę
- Rewrite this: <input type="text" id="original" name="original" value=""><br/>
- -->
- <!--</form> -->
- Rewrite Captcha: <input type="text" id="rewrite" name="rewrite" value="<%=rewrite%>"><br/>
- <input type="reset" id = "reload" value="Reload captcha">
- <input type="submit" id = "login" value="Login to servlet"><br/>
- <div><img id="picture" src ="generated.jpg"/></div>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement