<%@ 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("password");

	String str="";
	
	
try {
	Class.forName("oracle.jdbc.driver.OracleDriver");																	
	Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl", "20172262", "980930");	
	PreparedStatement pstmt = conn.prepareStatement("select * from member_fin");										
	ResultSet rs = pstmt.executeQuery();																			
		
	while(rs.next()){
		if(id.equals(rs.getString("id")) && passwd.equals(rs.getString("password"))) { 
			
			session.setAttribute("id", id);
			session.setAttribute("passwd", passwd);
			
			response.sendRedirect("Main.jsp");
		} else {
			str="실패했습니다. 돌아가기를 클릭해주세요.";
		}}}catch(Exception e){
			e.printStackTrace();
					
		}

%>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<b> <%=str%> </b>
	<form method="post" action="loginForm.jsp">
	<input type="submit" value="돌아가기">
	</form>
</body>
</html>