www.gusucode.com > ASP毕业设计在线考试管理系统源码 > ASP毕业设计在线考试管理系统源码\code\pwd.asp

    <%
if request.cookies("username")="" or request.cookies("userid")="" then
	'response.write "<script language='javascript'>alert('禁止非法进入!');"
	response.write "window.location='login.asp'</script>"
end if
%>
<!--#include file="db.asp"-->
<%
if request("oldpwd")<>"" then
sql="select * from User_info where userid="& request.cookies("userid")
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
  if rs("pwd")<>request("oldpwd") then
    response.redirect "pwd.asp?Message=wrong"
  else
    rs("pwd")=request("newpwd")
    rs.update
    response.redirect "pwd.asp?Message=ok"
  end if
end if
%>
<html>

<head>

<title>网上考试系统</title>
<base target="_self">
<script language="javascript">
function submitit()
{
var myform=document.editpwd;
  if (myform.oldpwd.value=="")
  {
    alert("原有密码不能为空!");
    return false;
  }
  else
  {
    if (myform.newpwd.value=="")
    {
      alert("新密码不能为空不能为空!");
      return false;
    }
    else
    {
      if (myform.confirmpwd.value=="")
      {
      alert("验证密码不能为空!");
      return false;
      }
      else
      {
        if (myform.newpwd.value!=myform.confirmpwd.value)
        {
          alert("新设密码和验证密码不相符!");
          return false;
        }
        else
        {
          return true;
        }
      }
    }
  }
}
</script>
<link href="Style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE2 {font-size: 10}
.STYLE4 {font-family: "Verdana", "Arial", "宋体"}
.STYLE5 {font-size: 10pt}
-->
</style>
</head>

<body topmargin="0" leftmargin="0" style="background-color: #F1F1F1">

<form method="POST" name="editpwd" action="pwd.asp" onSubmit="return submitit();">
  <div align="center">
    <center>
    <table border="0" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1" cellspacing="0">
      <tr>
        <%
if request("Message")="" then
%>
        <td colspan="2" height="20">&nbsp;</td>
        <%
else 
  if request("Message")="ok" then
%>
        <td colspan="2" height="20"><span class="STYLE2"><font color="#FF0000">成功修改密码!</font></span></td>
        <%
  else
%>
        <td width="96" height="20" colspan="2"><span class="STYLE2"><font color="#FF0000">旧密码输入错误!</font></span></td>
        <%
  end if
end if
%>
      </tr>
      <tr>
        <td width="60"><span class="STYLE5">旧密码:</span></td>
        <td width="73">
          <div align="left" class="STYLE5">
            <input type="password" name="oldpwd" size="8" class="smallInput">
          </div></td>
      </tr>
      <tr>
        <td><span class="STYLE5">新密码:</span></td>
        <td><span class="STYLE5"></font>
            <input type="password" name="newpwd" size="8"  class="smallInput">          
          </span></td>
      </tr>
      <tr>
        <td><span class="STYLE5">确认输入:</span></td>
        <td>
          <div align="left" class="STYLE5">
            <input type="password" name="confirmpwd" size="8"  class="smallInput">
          </div></td>
      </tr>
      <tr>
        <td colspan="2">
          <p align="center" class="STYLE5">
            <input name="I1" type="submit" class="STYLE4" value="提交修改" border="0">
          </td>
      </tr>
    </table>
    </center>
  </div>
</form>

</body>

</html>