<%@ 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 passwd=request.getParameter("passwd");
String name=request.getParameter("name");
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", "20182236", "990319");
	sql="select * from o_member where id=?";
	PreparedStatement pstmt=conn.prepareStatement(sql);
	pstmt.setString(1,id);
	
	rs=pstmt.executeQuery();
	
	if(rs.next()){
		String dbPass=rs.getString("password");
		if(passwd.equals(dbPass)){
			pstmt=conn.prepareStatement("update o_member set password=?, name=?, where id=?");
			
			pstmt.setString(1,id);
			pstmt.setString(2,passwd);
			pstmt.setString(3,name);
			
			pstmt.executeUpdate();
			out.println("정보수정 성공");
		}else{
			out.println("비밀번호틀림");
		}}
}catch(Exception e){
e.printStackTrace();
}finally{
}
%>
<!DOCTYPE html>
<html>
<head>
<title>레코드 삭제</title>
</head>
<body>
<p><A href="http://localhost:8080/member_20182236/p_member/list.jsp">click here!! </A></p>

</body>
</html>