Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%--
- Document : index
- Created on : Oct 20, 2018, 6:47:25 PM
- Author : Admin
- --%>
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <link rel="stylesheet" href="css/secondary.css">
- <title>Re-registration login</title>
- </head>
- <body>
- <div class="info-section">
- <h1 id="info-section-head">Login Status:</h1>
- <%@page contentType="text/html" %>
- <%@page import="javax.naming.*" %>
- <%@page import="java.sql.*" %>
- <%@page import="javax.sql.*" %>
- <%
- String enroll = "";
- Connection conn=null;
- Statement stmt=null;
- ResultSet rs=null;
- int flag = 0;
- try{
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- conn=DriverManager.getConnection("jdbc:odbc:mydsn");
- enroll = request.getParameter("enroll");
- String pass = request.getParameter("pass");
- session.setAttribute("enrolls",enroll);
- stmt=conn.createStatement();
- rs=stmt.executeQuery("select * from Table1 where EnrollmentNum='"+enroll+"'");
- //System.out.println(cid);
- while(rs.next()){
- String ps = rs.getString("Password");
- if(ps.equals(pass))
- flag = 1;
- }
- rs.close();
- rs=null;
- stmt.close();
- stmt=null;
- conn.close();
- conn=null;
- }
- catch(SQLException e){
- out.println("Throw e"+e);
- }
- if(flag==1){
- out.println("<span class='success'>Credentials matched, you're logged in! Enter below details to re-register.</span>");
- }
- %>
- <%
- if(flag==1){
- out.println("<form method='POST' action='submit.jsp'><div class='form__group'><input name='draft-num' type='tel' class='form__input' placeholder='Draft number' id='draftnum' pattern='[0-9]+' maxlength='15' minlength='9' required ></div> <div class='form__group'> <input name='amt' type='tel' class='form__input' placeholder='Amount' id='pass' minlength='3' required> </div><div class='form__group'> <button type='submit' class='form__btn' id='form__btn-reReg'>Submit</button> </div> </form>");
- }
- else{
- out.println("<span class='fail'></span>Credentials did not match, please try again! <a href=index.html>Go back.</a></span>");
- }
- %>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment