<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.sql.Connection" %>
    <%@ page import="java.sql.DriverManager" %>
    <%@ page import="java.sql.PreparedStatement" %>
    <%@ page import="java.sql.ResultSet" %>
    
    <% request.setCharacterEncoding("utf-8"); %>
    
    <%
    String id = request.getParameter("id");
    String password = request.getParameter("password");
    
    String str = "";
    
    try {
        
        Class.forName("oracle.jdbc.driver.OracleDriver");  //oracle드라이버 로드
        Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20162511","971204");  // 주소, 계정 틀리면 오류임
        PreparedStatement pstmt=conn.prepareStatement("select * from member");
        ResultSet rs = pstmt.executeQuery();
       
    
    while(rs.next()){
    	if (id.equals(rs.getString("id")) && password.equals(rs.getString("PASS"))) {
    		
    		session.setAttribute("id",id);
    		session.setAttribute("PASS",password);
    		
    		response.sendRedirect("main.jsp");
    	
    	}else{
    		%>
    		<script>
alert("아이디와 패스워드를 다시 확인 해주세요");
location.href="main.jsp?contentPage=NewFile2.jsp";
</script>
    		
    		<%
    		
    	
    	}}}catch(Exception e){
    		e.printStackTrace();
    }
    
    %>
