<!--#include file="../../Inc/Cls_Main.Asp"-->
<!--#include file="../inc/Cls_Admin.Asp"-->
<!--#include file="../inc/Cls_MapPath.Asp"-->
<!--#include file="../Admin_Check.Asp"-->
<%
Dim CmsAdmin
'=============================================================================
Set CmsAdmin = New Cls_Admin
CmsAdmin.SetAdminTitle = CmsSiteName
CmsAdmin.SetBodyCssName = "mainbody"
CmsAdmin.SetAdminPath = CmsAdminMapPath
CmsAdmin.LoadHead()
'=============================================================================
Dim Action
'=============================================================================
Action = Easp.Get("action")
Select Case Action
    Case "savemain"
        Call SaveMain()
    Case Else
        Call PageLoad()
End Select
CmsAdmin.LoadFooter()
Set CmsAdmin = Nothing

Sub PageLoad()
%>
<script src="<%=CmsAdminMapPath%>js/check/manager.pass.check.js"></script>
<form name="myform" id="myform" method="post" action="?action=savemain" onsubmit="return CheckForm();">
  <div class="navigation"> <a href="Admin.Index.Asp" class="back">管理员管理</a>控制面板 &gt; 管理员管理 &gt; 修改管理员密码</div>
  <div id="contentTab">
    <div class="content-tab">
      <ul class="tab_nav">
        <li><a onclick="tabs(this);" class="selected" href="javascript:void(0);">修改管理员密码</a></li>
      </ul>
    </div>
    <div class="tab_con" style="display: block;">
      <table class="form_table">
        <col width="200px">
        <col>
        <tbody>
          <tr>
            <th> 用 户 名： </th>
            <td class="td2"><input type="text" name="AdminName" id="AdminName" class="txtInput w300"  maxlength="50" autocomplete="off" readonly="readonly" value="<%=Easp.Cookie("ZjjCmsCms>AdminName")%>" />
              <label>*,无法修改</label></td>
          </tr>
          <tr>
            <th> 旧登录密码： </th>
            <td class="td2"><input type="password" name="AdminPassOld" id="AdminPassOld" class="txtInput w300"  maxlength="50" autocomplete="off" />
              <label>*</label></td>
          </tr>
          <tr>
            <th> 新登录密码： </th>
            <td class="td2"><input type="password" name="AdminPass" id="AdminPass" class="txtInput w300"  maxlength="50" autocomplete="off" />
              <label>*</label></td>
          </tr>
          <tr>
            <th> 新确认密码： </th>
            <td class="td2"><input type="password" name="AdminPass1" id="AdminPass1" class="txtInput w300"  maxlength="50" autocomplete="off" />
              <label>*</label></td>
          </tr>
          <tr>
            <th> </th>
            <td><input type="submit" value="提交保存" class="btnSubmit" /></td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</form>
<%
End Sub

Sub SaveMain()
    ChkSysAdminLevel "sys_manager", "pass"
    Dim AdminPassOld, AdminPass, AdminPass1
    AdminPassOld = Trim(Easp.Post("AdminPassOld:s"))
    AdminPass = Trim(Easp.Post("AdminPass:s"))
    AdminPass1 = Trim(Easp.Post("AdminPass1:s"))
    '=====================================================================
    If Easp.IsN(AdminPassOld) Then
        CmsAdmin.JscriptMsg "旧登录密码必须填写！", "back", "Error", "null"
    End If
    If Easp.IsN(AdminPass) Then
        CmsAdmin.JscriptMsg "新登录密码必须填写！", "back", "Error", "null"
    End If
    If Easp.IsN(AdminPass1) Then
        CmsAdmin.JscriptMsg "新确认密码必须填写！", "back", "Error", "null"
    End If
    If AdminPass <> AdminPass1 Then
        CmsAdmin.JscriptMsg "登录密码与确认密码不一致！", "back", "Error", "null"
    End If
    If Easp.MD5(AdminPassOld) <> Easp.Cookie("ZjjCmsCms>AdminPass") Then
        CmsAdmin.JscriptMsg "旧登录密码输入错误！", "back", "Error", "null"
    End If
    '=====================================================================
    Dim List, ResultVal
    Easp.Use "list"
    Set List = Easp.List.New
    List("AdminPass") = Easp.MD5(AdminPass)
    ResultVal = Easp.db.UR(TablePrefix & "Admin", " Id = "& CmsFun.ChkNumEric(Easp.Cookie("ZjjCmsCms>AdminId")) &" ", List.Hash)
    '=====================================================================
    Easp.C List
    If ResultVal <> 0 Then
        Easp.WE Easp.JsCode("alert('修改密码成功，请重新登录。');top.location.href='../Admin_Logout.Asp';")
    Else
        CmsAdmin.JscriptMsg "修改密码失败！", "back", "Error", "null"
    End If
    '=====================================================================
End Sub
%>
