<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	request.setCharacterEncoding("utf-8");
%>
<%@ page import="java.sql.*"%>
<%@ page session="true"%>
<%
	String id = request.getParameter("id");
	String password = request.getParameter("password");

	try {
		Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl", "20152488", "960504");
		PreparedStatement pstmt = conn.prepareStatement("select * from membership");
		ResultSet rs = pstmt.executeQuery();
		
		while (rs.next()) {
			if (id.equals(rs.getString("id")) && password.equals(rs.getString("password"))) {
				session.setAttribute("id", id);
				session.setAttribute("password", password);
				response.sendRedirect("main.jsp");
			} else {
				%><script>alert("아이디, 비밀번호 확인바람!!");
				location.href="loginForm.jsp";</script> <%
			}
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>

</body>
</html>