-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2b.jsp
More file actions
58 lines (55 loc) · 1.7 KB
/
2b.jsp
File metadata and controls
58 lines (55 loc) · 1.7 KB
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
50
51
52
53
54
55
56
57
58
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%
String url = "jdbc:mysql://localhost:3306/lab10project";
String user = "root";
String pass = "16104653";
Class.forName("com.mysql.jdbc.Driver").newInstance();
try
{
Connection conn = DriverManager.getConnection(url,user,pass);
Statement stmt = conn.createStatement();
String s=request.getParameter("Login");
String p=request.getParameter("id");
String q=request.getParameter("pass");
int t=0,f=0;
String j,i,x,y;
x=null;
if(s.equals("Agent"))
t=1;
if(s.equals("Seller"))
t=2;
if(s.equals("Buyer"))
t=3;
ResultSet r = null;
r= stmt.executeQuery("select * from "+s);
while(r.next())
{
x=r.getString("id");
y=r.getString("pass");
if(x.equals(p) && y.equals(q))
{
f=1;
break;
}
}
if(f==0)
{
session.setAttribute("error","0");
response.sendRedirect("2.jsp");
}
else
{
session.setAttribute("userid",x);
if(t==1)
response.sendRedirect("9.jsp");
if(t==2)
response.sendRedirect("5.jsp");
if(t==3)
response.sendRedirect("13.jsp");
}
}
catch(Exception e){
out.println("Exception : "+e.getMessage());
}
%>