<!--#include file="../inc/Conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="MelyySoft.Manage.Asp"-->
<%
PurviewValue="editpass"
If not CheckAdmin(PurviewValue) then
Response.Write("<script language=""JavaScript"">alert(""越权操作!"");history.go(-1);")
response.end
End If
if Request.QueryString("action")="Edit" then
id=request("id")
OldPassword=replace(trim(Request("OldPassword")),"'","")
NewPassword=replace(trim(Request("NewPassword")),"'","")
Purview=Fc_Clng(Trim(Request("Purview")))
AllPurview=Request("AllPurview")
DepartMent=trim(request("DepartMent"))
set rs=server.createobject("adodb.recordset")
sql="select * from admin where Id="&id
rs.open sql,conn,1,3

'更新管理员密码
If NewPassword<>"" then 
    if strLength(NewPassword)>16 or strLength(NewPassword)<6 then
	  response.write  "<script language=javascript>alert('请输入的密码位数不能小于6位或大于16位!');history.go(-1);</script>"
	  response.End
	end if
	if md5(OldPassword)<>rs("PassWord")  then
	  response.write  "<script language=javascript>alert('原密码错误，请返回重新输入!');history.go(-1);</script>"
	  response.End
	else    
	  rs("PassWord")=md5(NewPassword)
	end if 
End If

rs("AllPurview")=AllPurview

rs.update
rs.close
response.redirect "Admin_Manage.asp"
end if
%>


<%
id=request("id")
set rs=server.createobject("adodb.recordset")
sql="select * from admin where id=" & id
rs.open sql,conn,1,1
AllPurview=Rs("AllPurview")
ModifyPurview=Rs("Purview")
%>
<!-- #include file="Inc/Head.asp" -->
<SCRIPT language=javascript>
<!--
function myform_onsubmit()
{
if (document.myform.NewPassword.value!=document.myform.ConPassword.value)
{
alert ("新密码和确认密码不一致。");
document.myform.NewPassword.value='';
document.myform.ConPassword.value='';
document.myform.NewPassword.focus();
return false;
}
}
//-->
</SCRIPT>
<table width="560" border="0" cellpadding="0" cellspacing="1" class="border">
        <tr> 
          <td class="topbg" height="25"> <div align="center"><strong>管理员密码修改</strong></div></td>
        </tr>
        <tr> 
          <FORM name=myform  onsubmit="return myform_onsubmit()" action="Admin_ManageEdit.asp?action=Edit" method=post>   
<input type=hidden name=id value=<%=id%>>         
            <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
                
                <tr> 
                  <td width="29%" height="22" class="tdbgl"> <div align="right">管理员帐号：</div></td>
                  <td width="71%" class="tdbg"><%=rs("UserName")%></td>
                </tr>
                <tr>
                  <td height="22" class="tdbgl"><div align="right">旧密码：</div></td>
                  <td class="tdbg"><input name="OldPassword" type="password" size="16" maxlength="20"></td>
                </tr>
                <tr> 
                  <td height="22" class="tdbgl"> <div align="right">新密码：</div></td>
                  <td class="tdbg"><input name="NewPassword" type="password" size="16" maxlength="20"></td>
                </tr>
                <tr> 
                  <td height="22" class="tdbgl"> <div align="right">密码确认：</div></td>
                  <td class="tdbg"><input name="ConPassword" type="password" size="16" maxlength="20"></td>
                </tr>
				<%If purview=1 and rs("username")<>"admin" then%> <tr> 
                  <td width="29%" height="22" class="tdbgl"> <div align="right">部门：</div></td>
                  <td width="71%" class="tdbg"><input name="DepartMent" type="text" id="DepartMent" value="<%=rs("DepartMent")%>" size="16" maxlength="20"></td>
                </tr>
				 <tr> 
                  <td height="22" class="tdbgl"> <div align="right">权限设置：</div></td>
                  <td class="tdbg"><input name="Purview" type="radio" value="1" onClick="PurviewDetail.style.display='none'" <% if rs("purview")=1 then response.Write "checked" %>>超级管理员：拥有所有权限。某些权限（如管理员管理、网站信息配置、网站选项配置等管理权限）只有超级管理员才有。"
    <br> <input type="radio" name="Purview" value="2"   onClick="PurviewDetail.style.display=''" <%if rs("purview")=2 then response.Write "checked" %>  >普通管理员：需要详细指定每一项管理权限</td>
                </tr>
				<tr> 
                  <td colspan="2"  >
				  <table id="PurviewDetail" width="100%" border="0" cellspacing="10" cellpadding="0" style="display:">
    <tr><td  align='center'  class="Title"><strong>管 理 员 权 限 详 细 设 置</strong></td></tr>
	<tr> 
                 
                  <td height="22" colspan="2" class="tdbg"><%=GetPurview(AllPurview)%></td>
                </tr>
</table></td>
                  </tr><%end if%>
                <tr> 
                  <td height="22" class="tdbgl"><div align="center"></div></td>
                  <td height="22" class="tdbg"><input  type=submit value='确认修改' name=Submit2></td>
                </tr>
              </table></td>
          </form>
        </tr>
      </table>
<!-- #include file="Inc/Foot.asp" -->
