<%@ 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 name = request.getParameter("name");

   String sql="";
   String delsql="";
   
   ResultSet rs=null;
   String str="";
   
   try{
	 
	   Class.forName("oracle.jdbc.driver.OracleDriver");
	   Connection  conn=DriverManager.getConnection("jdbc:oracle:thin:@168.126.146.45:1521:orcl","20172262","980930");
	   sql="select * from member_fin where id=? and password=?";
	   PreparedStatement pstmt=conn.prepareStatement(sql);
	   pstmt.setString(1, id);
	   pstmt.setString(2, password);
	   rs=pstmt.executeQuery(); 
	  
	  if(rs.next()){
		  	pstmt=conn.prepareStatement("update member_fin set password=?, name=? where id=?");
			
	    	pstmt.setString(1, id);
	    	pstmt.setString(2, password);
	    	pstmt.setString(3, name);
		  
		  
		  pstmt.executeUpdate();
	  }
	    
		rs.close();
		pstmt.close();
		conn.close();  
	 	 
 	 str= "수정되었습니다.";
 	}catch(Exception e){ 
 		e.printStackTrace();
 		str="수정실패 다시 입력해주세요.";
	
 	}
 %>
<html>
<head>
<title>회원 정보 수정</title>
</head>
<body>

  <%= str %>  <p>
  
<a href="http://localhost:8080/Project_봉민우.JSP_B_final_20172262/Project_봉민우.JSP_B_final_20172262/list.jsp">회원 목록 보기 </a>
  
</body>
</html>