Advertisement
Yuvalxp8

Login Check (Using MySQL)

Apr 4th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 1.20 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/usersinfo"
  14.      user="root"  password="Slnm1855"/>
  15.      
  16. <sql:query dataSource="${snapshot}" var="result">
  17. select * from members where username ='${param.uname}';
  18. </sql:query>
  19.  
  20.    
  21.  
  22.  
  23. <c:choose>
  24.     <c:when test="${param.pass==result.rows[0].password}">
  25.         <%session.setAttribute("user", request.getParameter("uname")); %>
  26.         <%session.setMaxInactiveInterval(-1); %>
  27.         <%response.sendRedirect("SQLloginSuccess.jsp"); %>
  28.        
  29.     </c:when>
  30.     <c:otherwise>
  31.         <%response.sendRedirect("SQLloginFail.jsp"); %>
  32.     </c:otherwise>
  33. </c:choose>
  34.  
  35. </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement