<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page session="true" %>

<% request.setCharacterEncoding("utf-8");%>
<%	String id = request.getParameter("id");
	String passwd = request.getParameter("passwd");
	
	String str="";
	
	try{
		Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20162496","980216");
		PreparedStatement pstmt=conn.prepareStatement("select * from MEMBER_TABLE");
	    ResultSet rs= pstmt.executeQuery();
	    
	    while(rs.next()){
	    	if (id.equals(rs.getString("id")) && passwd.equals(rs.getString("passwd"))) {
	          	session.setAttribute("id", id);
	    		session.setAttribute("passwd", passwd);
	    		response.sendRedirect("main.jsp");
	    	} else {
	    		str="아이디와 비밀번호 확인";
	    	}}}catch(Exception e){
	    		e.printStackTrace();
	    	}
%>
<html>
<head>
<title>메시지</title>
</head>
<body>
<%=str %>
     
</body>
</html>