<%@ 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","20162486","970409");
	   sql="select id from MEMBER_2A where id=?";
	   PreparedStatement pstmt=conn.prepareStatement(sql);
	   pstmt.setString(1, id);
	   rs=pstmt.executeQuery();
	  	    
		if(rs.next()){
			String rid=rs.getString("id"); 
			
			if(id.equals(rid)){
				delsql="delete from MEMBER_2A where id=? and password=?";  // sql DELETE: DELETE FROM 테이블명  WHERE 삭제조건
				pstmt=conn.prepareStatement(delsql);
				pstmt.setString(1,id);
				pstmt.setString(2,password);
				pstmt.executeUpdate();
				
			}
		
		rs.close();
		pstmt.close();
		conn.close();  
	 	 
		response.sendRedirect("secession.jsp");

   }
		}catch(Exception e){ 
	   
 		e.printStackTrace();
 		
 	}
 %>
 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor="F5F5DC">
<script>
alert("계정을 확인해 주세요.");
location.href="main2.jsp";
</script>
</body>
</html>
