프로젝트/첫번째 jsp eclipes html 을 활용한..

아이디 찾기 비밀번호 찾기 header ,id_search,pass_search

IT새내기IM 2023. 1. 30. 16:11

header에 a태그를 걸어 id_search.sjp와  pass_search.jsp로 이동하도록 설정

			<a href="" onclick="id_s()">[아이디 찾기]</a>
			<a href="" onclick="pass_s()">[비밀번호 찾기]</a>
            
<script>
function id_s(){
	window.open("/member/id_search.jsp","b","width=500,height=200");
}
function pass_s(){
	window.open("/member/pass_search.jsp","c","width=500,height=200");
}
</script>

//다음과 같이 선언해서 클릭시 각 페이지로 이동할수있게

id_search

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/include/dbconnection.jsp" %>
<%@page import="java.sql.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
body{
		margin:0;
		padding:0;
		font-size:17px;
		background-color: black;
		color:white;
}
.button{
	border:0x solid black;    /*---테두리 정의---*/
	background-Color:black;   /*--백그라운드 정의---*/
	font:12px;      /*--폰트 정의---*/
	font-weight:bold;   /*--폰트 굵기---*/
	color:white;    /*--폰트 색깔---*/
	width:120;height:50;  /*--버튼 크기---*/
}

</style>
</head>
<body>

<%
String p1 = request.getParameter("p1");
String p2 = request.getParameter("p2");
String p3 = request.getParameter("p3");
String e1 = request.getParameter("e1");
String e2 = request.getParameter("e2");

String sql = "select * from member2 where phone1 = '"+p1+"' and phone2 = '"+p2+"' and phone3 = '"+p3+"' and email1 = '"+e1+"' and email2 = '"+e2+"'";
Connection con = DriverManager.getConnection(url, user, password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);

String id = "";
while(rs.next()){
	id = rs.getString("memberid");
}
%>

<form action="" member="post">
<table width=500 height=200 border=0 align="center" style="border:1px solid white;border-radius: 15px 15px 15px 15px;">
	<tr>
		<td width=15></td>
		<td>연락처</td>
		<td>
		&nbsp
			<input id="p1" name="p1" style="width:35px;" value="">
			<input id="p2" name="p2" style="width:35px;" value="">
			<input id="p3" name="p3" style="width:35px;" value="">
		</td>
	</tr>
	<tr>
		<td width=15></td>
		<td>메일주소</td>
		<td>
			&nbsp&nbsp<input id="e1" name="e1" value="">@<input id="e2" name="e2" value="">
		</td>
	</tr>
	<tr>
		<td width=15></td>
		<td>찾은 아이디 :
		</td>
		<td>
		&nbsp&nbsp
		<%if(id.equals("")){%>
			존재하지 않습니다.
		<%}else{%>
			<%=id%>
		<%}%>		
		</td>
	</tr>	
	<tr>
		<td width=15></td>
		<td></td>
		<td>&nbsp&nbsp<button class=button>아이디 찾기</button></td>
	</tr>
</table>

</form>
</body>
</html>

pass_search

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/include/dbconnection.jsp" %>
<%@page import="java.sql.*"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
body{
		margin:0;
		padding:0;
		font-size:17px;
		background-color: black;
		color:white;
}
.button{
	border:0x solid black;    /*---테두리 정의---*/
	background-Color:black;   /*--백그라운드 정의---*/
	font:12px;      /*--폰트 정의---*/
	font-weight:bold;   /*--폰트 굵기---*/
	color:white;    /*--폰트 색깔---*/
	width:120;height:50;  /*--버튼 크기---*/
}

</style>
</head>
<body>

<%
String id = "";
if(request.getParameter("id") != null){
	id = request.getParameter("id");
}

String p1 = request.getParameter("p1");
String p2 = request.getParameter("p2");
String p3 = request.getParameter("p3");
String e1 = request.getParameter("e1");
String e2 = request.getParameter("e2");

String sql = "select * from member2 where memberid = '"+id+"' and phone1 = '"+p1+"' and phone2 = '"+p2+"' and phone3 = '"+p3+"' and email1 = '"+e1+"' and email2 = '"+e2+"'";
Connection con = DriverManager.getConnection(url, user, password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(sql);

String pass = "";
while(rs.next()){
	pass = rs.getString("password");
}
%>

<form action="" member="post">
<table width=500 height=200 border=0 align="center" style="border:1px solid white;border-radius: 15px 15px 15px 15px;">
	<tr>
		<td width=15></td>
		<td>아이디</td>
		<td>
		&nbsp
			<input id="id" name="id" style="width:100px;" value="<%=id%>">
		</td>
	</tr>
	<tr>
		<td width=15></td>
		<td>연락처</td>
		<td>
		&nbsp
			<input id="p1" name="p1" style="width:35px;" value="<%=p1%>">
			<input id="p2" name="p2" style="width:35px;" value="<%=p2%>">
			<input id="p3" name="p3" style="width:35px;" value="<%=p3%>">
		</td>
	</tr>
	<tr>
		<td width=15></td>
		<td>메일주소</td>
		<td>
			&nbsp&nbsp<input id="e1" name="e1" value="<%=e1%>">@<input id="e2" name="e2" value="<%=e2%>">
		</td>
	</tr>
	<tr>
		<td width=15></td>
		<td>찾은 비번 :
		</td>
		<td>
		&nbsp&nbsp
		<%if(pass.equals("")){%>
		매칭되는 비밀번호가 없습니다
		<%}else{%>
		<%=pass%>
		<%}%>
			
			
		</td>
	</tr>	
	<tr>
		<td width=15></td>
		<td></td>
		<td>&nbsp&nbsp<button class=button>비밀번호 찾기</button></td>
	</tr>
</table>

</form>


</body>
</html>