<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Include/checklogin.asp" -->
<!--#include file="Include/connect.asp"-->
<!--#include file="../include/md5code.asp" -->
<!--#include file="top.asp"-->
<link href="CSS/right.css" rel="stylesheet" type="text/css">
<%
select case request("action")
case "saveedit"
call saveedit()
case else
call normal()
end select
sub normal()
%>
<SCRIPT language="javascript">
<!--
function dataCheck()
{
   if (modifypswform.adminname.value.length ==0)
   {
      alert("用户名不能为空！");
	  modifypswform.adminname.focus();
	  return false;
   }
   else if(modifypswform.newpwd.value.length ==0)
   {
      alert("请输入新密码！")
	  modifypswform.newpwd.focus();
	  return false;
   }
	else if(modifypswform.newpwd.value != modifypswform.newpwd2.value)
	{
		alert("您的确认密码与新密码不符，请重新输入。");
		modifypswform.newpwd.focus();
		return false;
	}
   else
   {
	   document.modifypswform.submit();
   }
}
//-->
</SCRIPT>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="tablecolor">
  <tr> 
    <td height="25" align="center" class="tablebody" colspan="2">修改密码</td>
  </tr>
  <form name="modifypswform" method="post" action="?action=saveedit" onSubmit="return dataCheck();">
    <tr > 
      <td width="30%" align="center" class="tablebody">用户名：</td>
      <td class="tablebody"><input name="adminname" type="text" id="adminname" value="<%=session("AdminUsername")%>" maxlength="50" readonly="1"></td>
    </tr>
    <tr > 
      <td align="center" class="tablebody">新密码：</td>
      <td class="tablebody"> <input name="newpwd" type="password" id="newpwd">
        至少6位</td>
    </tr>
    <tr > 
      <td align="center" class="tablebody">确认新密码：</td>
      <td class="tablebody"> <input name="newpwd2" type="password" id="newpwd2" maxlength="50"></td>
    </tr>
    <tr> 
      <td colspan="2" align="center"  class="tablebody"> <input type="submit" name="Submit" value="提交"> 
        &nbsp; <input type="reset" name="Submit2" value="重置"></td>
    </tr>
  </form>
</table>

<%
end sub
sub saveedit()
Username=request.form("adminname")
Password=request.form("newpwd")
set rs = server.CreateObject("adodb.recordset")
sql="select * from Show5_AdminUser where Username='"&Username&"'"
rs.open sql,cn,1,3
rs("Password")=md5(Password)
rs.update
rs.close
set rs=nothing
response.Write("<script>alert('修改成功！');location='default.asp'</script>")
end sub
%>
<!--#include file="end.asp"-->