<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*,com.xploits.oaudlc.connection.*" errorPage="" %>
<%
String pinid = request.getParameter("pinid");String surname = request.getParameter("surname");
String firstname = request.getParameter("firstname");
String othername = request.getParameter("othername");
String email = request.getParameter("email");String programtype = request.getParameter("programtype");
String academicsession = request.getParameter("academicsession");
String faculty_f = request.getParameter("faculty_f");
String department_f = request.getParameter("department_f");
String course_f = request.getParameter("course_f");String faculty_s = request.getParameter("faculty_s");
String department_s = request.getParameter("department_s");
String course_s = request.getParameter("course_s");String action = "";if(session.isNew())	{
	session.invalidate();
	response.sendRedirect("../index.jsp");
	return;
}	else if(pinid == null || pinid.equals(""))	{
%>	
	<h1>INVALID PIN productid</h1>
<%	
}	else if(!pinid.matches("\\w*"))	{
%>
	<h1>INVALID PIN productid</h1>
<%
}	else if(surname == null || surname.equals("") || firstname == null || firstname.equals("") || othername == null || othername.equals("") || email == null || email.equals(""))	{
%>	
<h1>PLS FILL IN ALL PERSONAL INFORMATION</h1>
<%	
	}	else if(faculty_f == null || faculty_f.equals("") || faculty_f.equals("Select a Faculty") || faculty_s == null || faculty_s.equals("") || faculty_s.equals("Select a Faculty") || department_f == null || department_f.equals("") || department_f.equals("Select a Department") || department_s == null || department_s.equals("") || department_s.equals("Select a Department") || course_f == null || course_f.equals("") || course_f.equals("Select a Course") || course_s == null || course_s.equals("") || course_s.equals("Select a Course"))	{
		
%>
<h1>PLS SELECT YOUR FIRST AND SECOND CHOICE FACULTY, DERPARTMENT AND COURSE</h1>
<%		
	}	else	{
		Connection conn = null;
		try{
			javax.naming.InitialContext ctx = new javax.naming.InitialContext();
			javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("java:comp/env/jdbc/oaudlc");
			conn = ds.getConnection(); 	
			action = SQLUtil.doAdmit(conn, pinid);
			conn.close();
			conn = null;
			}	catch(Exception ex)	{
				conn = null;
			}	finally	{
				try	{
					if(conn != null)	{
					conn.close();
					}
					conn = null;
				}	catch(Exception ex)	{
					conn = null;
				}
			}
			
			if(action.equals("VALID"))	{
			///do processing				
%>
<script type="text/javascript">
alert('Hello');
</script>
<%		
			}	else	{
%>			
	<h1>INVALID PIN productid	 </h1>
<%
}    		
}
%>