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

<!DOCTYPE html>
<html>
<head>
	<link href='../../css/join_style.css.css' rel='stylesheet' style='text/css'/>
</head>
<body>

<%
	String id = (String)session.getAttribute("id");
	String password = request.getParameter("password");   
	String passwordcheck = request.getParameter("passwordcheck");
	String name = request.getParameter("name");
	String gender = request.getParameter("gender");
	String birthyy = request.getParameter("birthyy");
	String birthdd = request.getParameter("birthdd");
	String birthmm = request.getParameter("birthmm");
	String email1 = request.getParameter("email1");
	String email2 = request.getParameter("email2");
	String phone = request.getParameter("phone");
	String address = request.getParameter("address");
	//ResultSet rs=null;
	String str = "";
	String sql=null;

try{
	   Class.forName("oracle.jdbc.driver.OracleDriver");
	   Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20150001","960323");
	   sql="update o_member2 set password=?, name=?, gender=?, birth=?, email=?, phone=?, address=? where id=?";
	   PreparedStatement pstmt=conn.prepareStatement(sql);
		  pstmt.setString(1,password);
		  pstmt.setString(2,name);
		  pstmt.setString(3,gender);
		  pstmt.setString(4,birthyy+"-"+birthdd+"-"+birthmm);
		  pstmt.setString(5,email1+"@"+email2);
		  pstmt.setString(6,phone);
		  pstmt.setString(7,address);
		  pstmt.setString(8,id);
	   
	      pstmt.executeUpdate(); //DB종료
		  pstmt.close();
	      conn.close();
	      %>
	<script>
	   alert("회원정보가 수정되었습니다.");
	   location.href="../../list/list.jsp"; //입력창이 출력되면서 list창을 화면전환
	</script>

	 <%
	}catch(Exception e){
	e.printStackTrace();
	%> 
	<script>
	   alert("오류 입니다.");
	   location.href="../../list/list.jsp"; //입력창이 출력되면서 list창을 화면전환
	</script>
 <% 
}finally{
  }
 %>

</body>
</html>