<%@ 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"%>

<% request.setCharacterEncoding("utf-8");%>

<%
  String id = request.getParameter("id");
  String password = request.getParameter("passwd");
  String name = request.getParameter("name");
  String gender = request.getParameter("gender");
  String email = request.getParameter("email");
  String email1 = request.getParameter("email1");
  String phone = request.getParameter("phone");
  String phone1 = request.getParameter("phone1");
  String phone2 = request.getParameter("phone2");
  String address = request.getParameter("address");

  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("insert into member_fin(id,password,name,gender,email,phone,address) values(?,?,?,?,?,?,?)");
	 pstmt.setString(1,id);
	 pstmt.setString(2,password);
	 pstmt.setString(3,name);
	 pstmt.setString(4,gender);
	 pstmt.setString(5,email + "@" + email1);
	 pstmt.setString(6,phone + "-" + phone1 + "-" + phone2);
	 pstmt.setString(7,address);
	
	 pstmt.executeUpdate();
	 pstmt.close();
	 conn.close();
	
     out.println("가입을 축하드립니다.");
}catch(Exception e){
	 e.printStackTrace();
	 str = "가입에 실패했습니다.";
}
%>
<!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>회원 가입</title>
</head>
<body>
	<%=str%>
	<form method="post" action="loginForm.jsp">
	<input type="submit" value="로그인 하기">
	</form>
</body>
</html>