Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%@ page contentType="text/html; charset=iso-8859-1" language="java"
- import="java.sql.*" errorPage="" %>
- <%
- PreparedStatement st = null;
- Connection conn = null;
- try {
- String email = request.getParameter("inputEmail3");
- String password = request.getParameter("inputPassword3");
- //Connect to the database
- Class.forName("oracle.jdbc.driver.OracleDriver");
- String hostname = "localhost";
- int port = 1521;
- String sid = "xe";
- String oracleURL = "jdbc:oracle:thin:@"+hostname+":"+port+":"+sid;
- String user = "system";
- String pass = "Imuslimah1";
- conn = DriverManager.getConnection(oracleURL, user, pass);
- st = conn.PreparedStatement();
- ResultSet rs;
- rs = st.executeQuery("select * from members where uname='" + email + "' and password = '" + password + "'");
- if (rs.next()) {
- session.setAttribute("inputEmail3", email );
- //out.println("welcome " + userid);
- //out.println("<a href='logout.jsp'>Log out</a>");
- response.sendRedirect("DatePage.html");
- } else {
- out.println("Invalid password <a href='validateLogin.html'>try again</a>");
- }
- //Run the query
- st.executeUpdate();
- conn.commit();
- st.close();
- conn.close();
- } catch (SQLException ex) {
- out.println("<p><b> Could not be registered due to a system error. </b></p><p>" + ex.getMessage()+ "<a href='validateLogin.html'>Go to Login</p>");
- st.close();
- conn.close();
- }
- %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement