-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathR_Authentication.jsp
50 lines (42 loc) · 1.74 KB
/
R_Authentication.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<title>Authentication Page</title>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@page import="java.util.*"%>
<%@ include file="connect.jsp"%>
<%@page import="java.util.*,java.security.Key,java.util.Random,javax.crypto.Cipher,javax.crypto.spec.SecretKeySpec,org.bouncycastle.util.encoders.Base64"%>
<%@ page import="java.sql.*,java.util.Random,java.io.PrintStream,java.io.FileOutputStream,java.io.FileInputStream,java.security.DigestInputStream,java.math.BigInteger,java.security.MessageDigest,java.io.BufferedInputStream"%>
<%@ page import="java.security.Key,java.security.KeyPair,java.security.KeyPairGenerator,javax.crypto.Cipher"%>
<%@page import="java.util.*,java.text.SimpleDateFormat,java.util.Date,java.io.FileInputStream,java.io.FileOutputStream,java.io.PrintStream"%>
<%
String ctype = request.getParameter("ctype");
String name = request.getParameter("userid");
String pass = request.getParameter("pass");
application.setAttribute("rname", name);
application.setAttribute("ctype", ctype);
String wait="Waiting";
String auth="Authorized";
try {
String sql = "SELECT * FROM enduser where name='" + name+ "' and pass='" + pass + "' and ctype='"+ctype+"'";
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(sql);
if (rs.next())
{
String sql1 = "SELECT * FROM enduser where name='" + name+ "' and pass='" + pass + "' and status='Authorized' ";
ResultSet rs1 = stmt.executeQuery(sql1);
if (rs1.next())
{
response.sendRedirect("R_Main.jsp");
}
else
{
response.sendRedirect("R_autho.jsp");
}
}
else
{
response.sendRedirect("wronglogin.html");
}
} catch (Exception e) {
out.print(e);
e.printStackTrace();
}
%>