-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreg.jsp
42 lines (34 loc) · 1.04 KB
/
reg.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
<%@page import="java.sql.*"%>
<%@page import="java.io.PrintWriter"%>
<%@page import="connection.Config"%>
<%
String scode = request.getParameter("scode");
String user = (String)session.getAttribute("studentid");
out.println(user);
if(user==null)
{
//not logged in
response.sendRedirect("index.jsp");
}
else
{
Connection con=null;
Statement st=null;
ResultSet rs=null;
Config c = new Config();
con = c.getcon();
int qno=0,cnt=0,cnt2=0;
try
{
st=con.createStatement();
String qry = "insert into result"+scode+"(username) values('"+user+"')";
st.executeUpdate(qry);
con.close();
response.sendRedirect("upcomingevents.jsp?Register=True");
}
catch(Exception e)
{
System.out.println("Error="+e);
}
}
%>