<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<%@ 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" %>

<%
String id = (String)session.getAttribute("id");
String name="";
String bir="";
String zipcode="";
String zip="";
String email="";
String job="";
try{
	Class.forName("oracle.jdbc.driver.OracleDriver");
	Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20162515","970623");
	PreparedStatement pstmt = conn.prepareStatement("select * from member_1 where id = ?");
	pstmt.setString(1, id);
	ResultSet rs = pstmt.executeQuery();

	if(rs.next()){
		name = rs.getString("name");
		bir = rs.getString("birthday");
		zipcode = rs.getString("zipcode");
		zip = rs.getString("zip");
		email = rs.getString("email");
		job = rs.getString("job");
	}
	pstmt.close();
	conn.close();
}catch(Exception e){
	e.printStackTrace();
}
%>
<script>
function Delete(){
	location.href="http://localhost:8080/Park20162515/Delete.jsp";
}
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>회원 정보 수정</title>
</head>
<body bgcolor="#777777" style="color : #eeeeee; text-align : left; width:750px; margin: 0 auto;">
<%
	if(session.getAttribute("login").equals("0") || session.getAttribute("id").equals("admin")){
		%> <script>alert('잘못된 접근입니다.'); location.href="http://localhost:8080/Park20162515/Main.jsp"</script><%
	}else {
		%><jsp:include page="Online.jsp" /><%
	}
%>
<hr>
<h1>회원 정보 수정</h1>
<form method ="post" action="EditPro.jsp"><br>
<table border="1" bgcolor="#eeeeee" style="color : #777777; width : 590px">
<tr>
<th>아이디</th>
<td colspan="3"> <%=session.getAttribute("id") %> </td>
</tr>
<tr>
<th>기존 패스워드 값</th>
<td><input type="password" name="pwc"></td>
<th>바꿀 패스워드 값</th>
<td><input type="password" name="pw"></td>
</tr>
<tr>
<th>이  름</th>
<td colspan="3"><input type="text" name="name" value="<%=name %>" size="40"></td>
</tr>
<tr>
<th>생년월일</th>
<td colspan="3"><input type="date" name="brithday" value="<%=bir %>"></td>
</tr>
<tr>
<th>우편번호</th>
<td colspan="3"><input type="text" name="zipcode" value="<%=zipcode %>"></td>
</tr>
<tr>
<th>집 주 소</th>
<td colspan="3"><input type="text" name="zip" value="<%=zip %>" size="40"></td>
</tr>
<tr>
<th>이 메 일</th>
<td colspan="3"><input type="text" name="email" value="<%=email %>" size="40"></td>
</tr>
<tr>
<th>직  업</th>
<td colspan="3"><input type="text" name="job" value="<%=job %>" size="40"></td>
</tr>
</table>
<p style="text-align : right; padding : 0px 160px; float : right">
<input type="submit" value="수 정 하 기">&nbsp;&nbsp;<input type="button" value="탈 퇴 하 기" onclick="Delete();">
</p> 
</form>
</body>
</html>