<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %> <%@ page import= "java.sql.*" %> <%@ page import= "java.sql.*" %> <% String name = (String)session.getAttribute("name"); String aname = (String)session.getAttribute("username"); String password = (String)session.getAttribute("password"); Connection con; ResultSet rs; Statement st; if(name ==null && aname==null && password ==null) { response.sendRedirect("index.jsp"); } else{ try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://localhost/iitDB","root","91don699629"); st=con.createStatement(); %> Department of Biotechnology
 





 


<% String fac_user_id = request.getParameter("fac_user_id"); String fac_password = request.getParameter("fac_password"); String fac_name = request.getParameter("fac_name"); if(fac_user_id !=null && fac_password !=null) { rs=st.executeQuery("select username,password from adminfac where username='"+fac_user_id+"' and password ='"+fac_password+"'"); if(!rs.next()) { rs = st.executeQuery("select max(id)+1 from adminfac"); rs.next(); int i= rs.getInt(1); st.executeUpdate("insert into adminfac (id,name, username, password) values ("+i+",'"+ fac_name +"','" +fac_user_id +"','" +fac_password+"')"); response.sendRedirect("faccrtsuc.jsp?fac_user_id="+fac_user_id +"&"+fac_password); }else { %>

User Id already Exist, Please try with another <% } } %>

ADD New Faculty
 Name
 User Id
  (for new faculty)
 Password

                 
 

 
<% con.close(); } catch(SQLException sqle){ System.err.println(sqle.getMessage()); } catch (ClassNotFoundException cnfe){ System.err.println(cnfe.getMessage()); } catch (Exception e){ out.println(e.getMessage()); out.println("sql Exexption"); }} %>