<%@ 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("password");
String passwd = request.getParameter("passwd");
String name = request.getParameter("name");
String birth = request.getParameter("birth");
String month = request.getParameter("month");
String day = request.getParameter("day");
String addnumber = request.getParameter("addnumber");
String ressnumber = request.getParameter("ressnumber");
String address = request.getParameter("address");
String addressx = request.getParameter("addressx");
String email = request.getParameter("email");
String emails = request.getParameter("emails");
String job = request.getParameter("job");

String str="";

try{
	Class.forName("oracle.jdbc.driver.OracleDriver");
	Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl", "20182263","980629");
	PreparedStatement pstmt = conn.prepareStatement("insert into member_1(id, password, name, birth, month, day, addnumber, ressnumber, address, addressx, email, emails, job) values(?,?,?,?,?,?,?,?,?,?,?,?,?)");
	pstmt.setString(1, id);
	pstmt.setString(2, password);
	pstmt.setString(3, name);
	pstmt.setString(4, birth);
	pstmt.setString(5, month);
	pstmt.setString(6, day);
	pstmt.setString(7, addnumber);
	pstmt.setString(8, ressnumber);
	pstmt.setString(9, address);
	pstmt.setString(10, addressx);
	pstmt.setString(11, email);
	pstmt.setString(12, emails);
	pstmt.setString(13, job);
	
	pstmt.executeUpdate();
	pstmt.close();
	conn.close();
	
	str = "회원가입에 성공했습니다.";
	}catch(Exception e){
		e.printStackTrace();
		str = "회원가입에 실패했습니다.";
	}
%>
<html>
<head>
<title>사용자 등록 확인</title>
<style>
  table {
    width: 70%;
    border: 2px solid #444444;
    border-collapse: collapse;
  }
  td {
    border: 1.5px solid #444444;
    padding: 9px;
  }
  #gap {
    margin: 9px;
  }
</style>
</head>
<body>
<div align="center" style="font-size:25px; font-weight:bold;" id="gap">회원가입</div>
<div align="center"><%=str %></div><br>

<table width="620" align="center">
<tr>
<td bgcolor="#E6E6E6" width="100">
<div align="center">사용자 ID</div>
</td>
<td colspan="3"><%=id %></td>
</tr>

<tr>
<td bgcolor="#E6E6E6" width="100">
<div align="center">비밀번호</div>
</td>
<td width="140"><%=password %></td>
</tr>

<tr>
<td bgcolor="#E6E6E6" width="100">
<div align="center">사용자 이름</div>
</td>
<td colspan="3"><%=name %></td>
</tr>

<tr>
<td bgcolor="#E6E6E6" width="100">
<div align="center">생년월일</div>
</td>
<td colspan="3"><%=birth %>년<%=month %>월<%=day %>일</td>
</tr>

<tr>
<td bgcolor="#E6E6E6" width="100">
<div align="center">우편번호</div>
</td>
<td colspan="4"><%=addnumber %>-<%=ressnumber %></td>
</tr>

<tr>
<td bgcolor="#E6E6E6" width="100">
<div align="center">주소</div>
</td>
<td colspan="4"><%=address %></td>
</tr>

<tr>
<td bgcolor="#E6E6E6" width="100">
<div align="center">나머지주소</div>
</td>
<td colspan="3"><%=addressx %></td>
</tr>

<tr>
<td bgcolor="#E6E6E6" width="100">
<div align="center">E-Mail</div>
</td>
<td colspan="3"><%=email %>@<%=emails %></td>
</tr>

<tr>
<td bgcolor="#E6E6E6" width="100">
<div align="center">직업</div>
</td>
<td colspan="3"><%=job %></td>
</tr>
</table>
<div align="center"><a href="http://localhost:8080/Exam/MainPage.jsp">홈으로</a></div>
</body>
</html>
