-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreg_Check.jsp
71 lines (56 loc) · 2.39 KB
/
reg_Check.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<%@page import ="java.sql.*" %>
<%@page import ="java.io.IOException" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.io.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Registration Check</title>
<script type="text/javascript">
function alertName(){
alert("Invalid Credentials");
}
</script>
</head>
<body>
<%
String reg_no = request.getParameter("reg_no");
try{
Class.forName("com.mysql.jdbc.Driver");
java.sql.Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/survey","root","");
PreparedStatement theStatement = conn.prepareStatement("select * from master_student_data where reg_no=?");
theStatement.setString(1,request.getParameter("reg_no"));
request.setAttribute("alertMsg", "data");
ResultSet rs = theStatement.executeQuery();
session.setAttribute("userkey","1");
if(rs.next())
{
int survey_status = rs.getInt("survey_status");
String name = rs.getString("name");
String img = rs.getString("img_url");
rs.getInt("survey_status");
if(survey_status == 0)
{
session.setAttribute("reg",reg_no);
session.setAttribute("name", name);
session.setAttribute("img",img);
response.sendRedirect("takesurvey.jsp");
}
else
{
String redirectURL = "surveylogin2.html";
response.sendRedirect(redirectURL);
}
}
else
{
String redirectURL = "surveylogin1.html";
response.sendRedirect(redirectURL);
}
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
%>
</body>
</html>