if(form1.PWD1.value!=form1.PWD2.value){
alert("您两次输入的密码不一致,请重新输入!");
form1.PWD1.value="";form1.PWD2.value="";form1.PWD1.focus();return;}
if(form1.Email.value==""){
alert("请输入Email地址!");form1.Email.focus();return; }
form1.submit();
}
</script>
<tr>
<td colspan="2" align="center"><input type="button" name="save" value="保存" onclick="mycheck()">
<input type="reset" name="re" value="重置"></td>
</tr>
</table>
</form>
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
reg_deal.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" scope="page" class="beans.connDB"/>
<%
request.setCharacterEncoding("GB2312");
String username=request.getParameter("username");
String PWD=request.getParameter("PWD1");
String birthday=request.getParameter("birthday");
String sex=request.getParameter("sex");
String OICQ=request.getParameter("OICQ");
String tel=request.getParameter("tel");
String homepage=request.getParameter("homepage");
String address=request.getParameter("address");
String postcode=request.getParameter("postcode");
String Email=request.getParameter("Email");
ResultSet rs=connBean.executeQuery("select * from tb_user where username='"+username+"'");
if (rs.next()){
out.println("<script language='javascript'>alert('该用户名已经存在,请重新注册!');window.location.href='reg.jsp';</script>");
}else{
String sql="Insert into tb_User values('"+username+"','"+PWD+"','"+birthday+"','"+ sex+"','"+OICQ+"','"+tel+"','"+homepage+"','"+ address+"','"+postcode+"','"+Email+"',default )";
int ret=0;
ret=connBean.executeUpdate(sql);
if (ret!=0){
out.println("<script language='javascript'>alert('用户注册成功!');window.location.href='index.jsp';</script>");
}else{
out.println("<script language='javascript'>alert('用户注册失败!');window.location.href='reg.jsp';</script>");
}
}
%>
Longin_User.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" scope="page" class="beans.connDB"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS/style.css" rel="stylesheet">
<title>蓝天一色留言簿</title>
</head>
<body onLoad="form1.username.focus();">
<center>
<table width="100%" height="199" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
<tr>
<td width="2%" height="26" background="images/bg_banner.GIF"> </td>
<td width="98%" background="images/bg_banner.GIF" class="word">用户登录</td>
</tr>
<tr valign="top">
<td height="169" colspan="2"><form name="form1" method="post" action="Login_User_deal.jsp">
<table width="290" height="149" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="35%" height="20"><div align="center"></div></td>
<td width="65%"> </td>
</tr>
<tr>
<td><div align="center">用户名:</div></td>
<td><input name="username" type="text" class="table" id="username" size="20"></td>
</tr>
<tr>
<td><div align="center">密 码:</div></td>
<td><input name="PWD" type="password" class="table" id="PWD" size="20"></td>
</tr>
<tr align="center">
<td colspan="2"><input name="Submit" type="submit" class="button" value="确定">
<input name="Submit" type="reset" class="button" value="取消"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</center>
</body>
</html>
Login_User_deal.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" scope="page" class="beans.connDB"/>
<%
request.setCharacterEncoding("GB2312");
String username=request.getParameter("username");
String PWD=request.getParameter("PWD");
if(username!=""){%>
<% ResultSet rs=connBean.executeQuery("select * from tb_User where UserName='"+username+"' and status='用户'");
if (rs.next()){
String rsPWD=rs.getString("PWD");
if(PWD.equals(rsPWD)){%>
<script language="javascript">
opener.location.reload();
window.close();
</script>
<%
session.setAttribute("username",username);
}else{%>
<script language="javascript">
alert("您输入的密码不正确,请重新输入!");
history.back();
</script>
<%}
}else{ %>
<script language="javascript">
alert("您输入的用户名不正确,请重新输入!");
history.back();
</script>
<%}
}%>
Longin_manage.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<jsp:useBean id="connBean" scope="page" class="beans.connDB"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS/style.css" rel="stylesheet">
<title>蓝天一色留言簿</title>
</head>
<body onLoad="form1.username.focus();">
<center>
<table width="100%" height="199" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
<tr>
<td width="2%" height="26" background="images/bg_banner.GIF"> </td>
<td width="98%" background="images/bg_banner.GIF" class="word">版主登录</td>
</tr>
<tr valign="top">
<td height="169" colspan="2"><form name="form1" method="post" action="Login_manager_deal.jsp">
<table width="290" height="149" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="35%" height="20"><div align="center"></div></td>
<td width="65%"> </td>
</tr>
<tr>
<td><div align="center">版主名称:</div></td>
<td><input name="username" type="text" class="table" id="username" size="20"></td>
</tr>
<tr>
<td><div align="center">密 码:</div></td>
<td><input name="PWD" type="password" class="table" id="PWD" size="20"></td>
</tr>
<tr align="center">
<td colspan="2"><input name="Submit" type="submit" class="button" value="确定">
<input name="Submit" type="reset" class="button" value="取消"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</center>
</body>
</html>
Login_manage_deal.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" 需要完整内容的请联系QQ752018766,JSP留言簿系统没有版权免费,转发请注明源于www.youerw.com
session.setAttribute("username",Manager);
}else{%>
<script language="javascript">
alert("您输入的密码不正确,请重新输入!");
history.back();
</script>
<%}
}else{ %>
<script language="javascript">
上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页