⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatepwd.jsp

📁 面向对象软件工程案例
💻 JSP
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--   **************************************************************
       **项目名称:网上书店管理端            ************************
       **内容:修改管理员密码                ************************
       **此页作者:luic                      ************************
       **完成日期:2004/4/25                 ************************
       **修改: 调试通过                     ************************
       **说明:本页主要实现管理员密码更改    ************************
       **  基于多个管理员帐户,而非单一管理员 ************************
       **************************************************************
-->
<%@ page contentType="text/html; charset=GBK"%> 
<%@ page import="java.sql.*" %>
<%
    String adminName=(String)session.getAttribute("name");      //从session变量中取出管理员的登录名
    if(adminName==null||adminName=="")                          //如果取不到管理员登陆名,则跳转到登录界面,防止未授权访问
      response.sendRedirect("login.jsp");
   	request.setCharacterEncoding("GBK");
	String flag = request.getParameter("flag");                //取出标志位,主要控制错误信息弹出的时机
	String oldPassword = request.getParameter("password");     //取旧密码
	String password = request.getParameter("newPwd");          //取出新密码
	int count=1;                                               //设置密码更改成功与否的标志位,初始为1
%>

<HTML><HEAD><TITLE>网上商店</TITLE>
<STYLE>HTML {
	TEXT-DECORATION: none
}
A:link {
	COLOR: #000000; TEXT-DECORATION: underline
}
A:active {
	COLOR: #000000; TEXT-DECORATION: underline
}
A:visited {
	COLOR: #000000; TEXT-DECORATION: underline
}
A:hover {
	COLOR: rgb(0,147,43); TEXT-DECORATION: underline
}
EM {
	FONT-SIZE: 16pt; FONT-STYLE: normal; FONT-FAMILY: CourierNew
}
A {
	FONT-SIZE: 9pt
}
TD {
	FONT-SIZE: 9pt
}
P {
	FONT-SIZE: 9pt
}
.hh INPUT {
	BORDER-RIGHT: 1px solid; BORDER-TOP: 1px solid; BORDER-LEFT: 1px solid; BORDER-BOTTOM: 1px solid; BACKGROUND-COLOR: #ffffff
}
</STYLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD>
<BODY text=#000000 vLink=#000000 aLink=#000000 link=#000000 bgColor=#ffffff 
leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">
<SCRIPT>

	document.forms[0].oldPassword.focus();

	function validator(theForm)
	{
	    if (theForm.password.value == "")
  		{
    		alert("请输入原密码");
    		theForm.password.focus();
   			return (false);
  		}
		if (theForm.newPwd.value == "")
  		{
   			alert("请输入新密码");
   			theForm.newPwd.focus();
   			return (false);
  		}
		if (theForm.repass.value == "")
  		{
   			alert("请输入确认密码");
   			theForm.repass.focus();
  			return (false);
  		}

		if(theForm.newPwd.value != theForm.repass.value)
		{
   			alert("新密码与确认密码不匹配");
   			theForm.repass.focus();
  			return (false);
		}
		return true;
	}

</SCRIPT>
<%
	String url=new String();
	url="jdbc:odbc:bookStore";
	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	Connection con=DriverManager.getConnection(url);
	Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
	String SQL=new String();
	SQL = "select * from Admin  where name='" +adminName+ "'and password='" +oldPassword+ "'";
    ResultSet rs = stmt.executeQuery(SQL);
	if(!rs.next()) {
		count=0;
		rs.close();
	}
	else{
		String str1="'"+adminName+"'";
		String str2="'"+password+"'";
		String pwdUpd="update Admin set password="+str2+"where name="+str1;
		stmt.executeUpdate(pwdUpd);
		stmt.close();
		con.close();
	}

%>
<TABLE cellSpacing=0 cellPadding=0 width=776 align=center border=0>
  <TBODY>
  <TR>
    <TD><IMG height=63 src="images/guide_0.gif" width=238></TD>
    <TD><IMG height=63 src="images/guide_1.gif" width=538></TD></TR>
    <TD><IMG height=35 src="images/guide_2.gif" width=238></TD>
    <TD background=images/guide_3.gif height=35>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD colSpan=2 height=10><IMG height=13 src="images/space.gif" 
            width=10></TD></TR>
        <TR>
          <TD width="8%"> </TD>
          <TD width="92%"><FONT color=#ffffff>■ 
    		管理员修改密码</FONT></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=776 align=center border=0 height="414">
  <TBODY>
      <TD vAlign=top width=195 bgColor=#ffffff height=48>
      <TABLE height=48 cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <td width="99%" height="48" bgcolor="#99CC66">
    	<p align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="黑体" size="4">
		&nbsp;
		&nbsp;功能列表 </font>
   	</td></TR></TBODY></TABLE></TD>
    <TD vAlign=top width=581 bgColor=#ffffff height=414 rowspan="2" bordercolor="#8EEB32">
      <TABLE cellSpacing=4 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR vAlign=top>
          <TD height=389>
            <P align=left>
            <DIV>
<%
	if(flag != null )
	{
		if( count == 0 )
			out.print("<center><font color='#FF0000'>原密码不正确</font></center>");
		else
		{
			out.print("<center><font color='#FF0000'>密码修改成功</font></center>");
		}
	}
%>

            </DIV>
            <form action="updatePwd.jsp" method="post" onSubmit="return validator(this)">
             <input name="flag" type="hidden" value="1">
            	<p><br>
 </p>
            <TABLE cellSpacing=1 cellPadding=4 width="60%" align=center 
border=0>
              <TBODY>
              <TR>
                <TD width="29%" bgColor=#99cc66>
                  <DIV align=right>原密码:</DIV></TD>
                <TD width="71%" bgColor=#f3f3f3><INPUT type=password 
                  name=password> </TD></TR>
              <TR>
                <TD width="29%" bgColor=#99cc66>
                  <DIV align=right>新密码:</DIV></TD>
                <TD width="71%" bgColor=#f3f3f3>
				<INPUT type=password 
                  name=newPwd size="20"> </TD></TR>
              <TR>
                <TD width="29%" bgColor=#99cc66>
                  <DIV align=right>重复新密码:</DIV></TD>
                <TD width="71%" bgColor=#f3f3f3><INPUT type=password 
                  name=repass> </TD></TR>
              <TR>
                <TD width="29%" bgColor=#99cc66>
                  <DIV align=right></DIV></TD>
                <TD width="71%" bgColor=#f3f3f3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <INPUT type=submit value=提交 name=cc></TD></TR></TBODY></TABLE></FORM>
            <P></P><FONT color=#000000>&nbsp; 
  </FONT></TD></TR></TBODY></TABLE></TD></TR>
	<tr>
    <TD vAlign=top width=195 bgColor=#ffffff height=366>
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber1" bgcolor="#bede9e" height="266">

  <tr>
    <td width="100%" height="19">
    	<p align="center">【 <a href="addBook.htm">添加图书</a>】
   	</td>
  </tr>
  <tr>
    <td width="100%" height="19">
    	<p align="center">【<a target="mainBody" href="dealBook.jsp">
   		删除图书</a>】
   	</td>
  </tr>
<tr>
    <td width="100%" height="19">
    	<p align="center">&nbsp;【<a href="modifyRoomPre.jsp"   target="mainBody">
   		</a><a href="dealBook.jsp">维护图书</a>】
   	</td>
  </tr>
<tr>
    <td width="100%" height="19">
    	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 【<a href="roomList.jsp"   target="mainBody">
   		</a><a href="userView.jsp">用户管理</a>】
   	</td>
  </tr>
  <tr>
    <td width="100%" height="19">
    	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 【<a href="userList.jsp"   target="mainBody">
   		</a><a href="dealOrder.jsp">订单处理</a>】
   	</td>
  </tr>
  <tr>
    <td width="100%" height="19"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;【<a target="mainBody" href="updatePwd.jsp">
   		密码<u>更改</u></a>】
    </td>
  </tr>
<tr>
    <td width="100%" height="19"> 
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 【<a target="mainBody" href="logout.jsp">
   		退出管理</a>】
    </td>
    
  </tr>
  
  </table></TD>
    </tr>
	</TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=776 align=center border=0>
  <TBODY>
  <TR bgColor=#89c86a>
    <TD><IMG height=1 src="images/space.gif" width=10></TD></TR>
  <TR>
    <TD height=1><IMG height=1 src="images/space.gif" width=10></TD></TR>
  <TR bgColor=#89c86a>
    <TD> </TD></TR></TBODY></TABLE>
<div align="center">
	<table border="0" style="border-collapse: collapse" width="776" id="table1" cellpadding="0">
		<tr>
			<td>
			<p align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<br>
			版权所有 ◎2003-2004 All rights resevered</td>
		</tr>
	</table>
</div>

</BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -