<%@ 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"%>
<%
   String dbid = (String)session.getAttribute("id");
	String dbpassword = "";
	String dbname = "";
	String dbgender = "";
	String dbbirth = "";
	String dbemail = "";
	String dbphone = "";
	String dbaddress = "";
   ResultSet rs = null;
   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="select * from o_member2 where id=?";
	   PreparedStatement pstmt=conn.prepareStatement(sql);
	   pstmt.setString(1, dbid);
	   
	   rs=pstmt.executeQuery(); //결과 가져옴
	  
	  if(rs.next()){
	  dbpassword=rs.getString("password");
	  dbname=rs.getString("name");
	  dbgender=rs.getString("gender");
	  dbbirth=rs.getString("birth");
	  dbemail=rs.getString("email");
	  dbphone=rs.getString("phone");
	  dbaddress=rs.getString("address");
	  }
	   
}catch(Exception e){
e.printStackTrace();
out.print("오류");
}finally{
}
%>
<html>
<head>
 		 <link href='../../css/join_style.css.css' rel='stylesheet' style='text/css'/>
  
    <title>현재 유저정보 출력화면</title>
  
       <script type="text/javascript">
       
       function changeForm(val){
            if(val == "0"){
                location.href="UpdateForm.jsp";
            }else if(val == "1"){
                location.href="DeleteForm.jsp";
            }
       }
        
  </script>
</head>
<body>
		       <div id="wrap">
				<br><br>
				<b><font size="6" color="gray">내정보</font></b>
				<br><br><br>
		                        <!-- 가져온 회원정보를 출력한다. -->
		        <table>
		            <tr>
		                <td id="title">아이디</td>
		                <td>
		                   <%= dbid%>
		                </td>
		            </tr>
		                        
		            <tr>
		                <td id="title">비밀번호</td>
		                <td>
		                   <%= dbpassword %>
		                </td>
		            </tr>
		                    
		            <tr>
		                <td id="title">이름</td>
		                <td>
		                   <%= dbname %>
		                </td>
		            </tr>
		                    
		            <tr>
		                <td id="title">성별</td>
		                <td>
		                   <%= dbgender %>
		                </td>
		            </tr>
		                    
		            <tr>
		                <td id="title">생일</td>
		                <td>
		                    <%= dbbirth %>
		                </td>
		              
		            </tr>
		                    
		            <tr>
		                <td id="title">이메일</td>
		                <td>
		                   <%= dbemail %>
		                </td>
		              
		            </tr>
		                    
		            <tr>
		                <td id="title">휴대전화</td>
		                <td>
		                   <%= dbphone %>
		                </td>
		            </tr>
		            <tr>
		                <td id="title">주소</td>
		                <td>
		                   <%= dbaddress %>
		                </td>
		                
		            </tr>
		        </table>
		        
		        <br>
		        <input type="button" value="회원정보 변경" onclick="changeForm(0)" class= "btn">
		        <input type="button" value="회원탈퇴" onclick="changeForm(1)" class= "btn">
		</body>
		</html>