GameNCode

Login Check SQL

Feb 8th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <%@ page language="java" contentType="text/html; charset=windows-1255" pageEncoding="windows-1255"%>
  2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
  8. <link rel="stylesheet" type="text/css" href="Style.css">
  9. <title>Checker</title>
  10. </head>
  11. <body>
  12. <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
  13. url="jdbc:mysql://localhost/members"
  14. user="root" password="1234"/>
  15.  
  16. <sql:query dataSource="${snapshot}" var="result">
  17. select * from users where user ='${param.uname}';
  18. </sql:query>
  19.  
  20.  
  21.  
  22.  
  23. <c:choose>
  24. <c:when test="${param.pass==result.rows[0].pass}">
  25. <%session.setAttribute("user", request.getParameter("uname")); %>
  26. <%session.setMaxInactiveInterval(-1); %>
  27. <%response.sendRedirect("loginSuccess.jsp"); %>
  28.  
  29. </c:when>
  30. <c:otherwise>
  31. <%response.sendRedirect("loginFail.jsp"); %>
  32. </c:otherwise>
  33. </c:choose>
  34.  
  35. </body>
  36. </html>
Add Comment
Please, Sign In to add comment