<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="java.sql.*"%>
    <%request.setCharacterEncoding("utf-8");%>
    <%
    Connection conn = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    String str = "";
    try
    {
    	Class.forName("oracle.jdbc.driver.OracleDriver");
    	conn = DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20172300","980612");
    	String sql = "select*from O_MEMBER";
    	pstmt = conn.prepareStatement(sql);
    	rs = pstmt.executeQuery();
    	
    	while(rs.next())
    	{
    		String ID = rs.getString("ID");
    		String PASSWORD = rs.getString("PASSWORD");
    		String NAME = rs.getString("NAME");
    		if(ID.equals(request.getParameter("ID")) && PASSWORD.equals(request.getParameter("PASSWORD"))){
    			session.setAttribute("loginUser", NAME);
    			response.sendRedirect("main.jsp");
    		}
    		else
    		{
    			str = "아이디 또는 비밀번호를 다시 확인하세요.";
    		}
    	}
    }
    catch(Exception e)
    {
    	e.printStackTrace();
    }
    finally
    {
    	if(rs != null)
    		try{rs.close();}catch(SQLException sqle){}
    	if(pstmt != null)
    		try{pstmt.close();}catch(SQLException sqle){}
    	if(conn != null)
    		try{conn.close();}catch(SQLException sqle){}
    }
    %>
    <body>
    <% if(str != null){%>
    <%=str%>
    <%} %>
    </body>