<!--#include file="check.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>管理员管理</title>
<link href="images/main.css" rel="stylesheet" type="text/css" media="all" />
</head>
<!--#include file="top.asp"-->
<div id="systime"><p id="servertime"></p></div>
<div id="mainBody" >

<div class="space">&nbsp;</div>
<div class="list">

<script language="javascript">
try{
    var nav="H09";
    var subnav="L0901";
	
    document.getElementById(nav).className="current";
    document.getElementById(subnav).className="first current";
    document.getElementById(subnav).parentNode.parentNode.style.display="block";

}catch(e){
	document.getElementById("H09").className="current";
}
</script>




<%
Call hrPower(8.1,0)
dim action,adid
action=request.QueryString("action")
adminid=request.QueryString("adminid")

select case action
case "list"
%>

<td align="right" width="100%"><a href="admin.asp?action=addnew"><b>增加管理员</b></a></td>

<table class="listtable">
  <thead>
    <tr>
      <th scope="col">管理员</th>
	  <th scope="col">最后登录时间</th>
            <th scope="col">最后登录IP</th>
            <th scope="col">操作</th>

    </tr>
  </thead>
  <tbody> 



			 <%
		    set Rs=GrateRs("select * from H_admin order by adminid",1)
			do while not Rs.eof 
			%>

         <tr class="listtr1" >

			<td><%=Rs("username")%></td><td><%=Rs("lasttime")%></td><td><%=Rs("lastip")%></td><td style="width:140px;"><a href="admin.asp?action=edit&adminid=<%=Rs("adminid")%>">编辑</a>｜<a href="javascript:if(confirm('确实要删除?'))location='admin.asp?action=del&adminid=<%=Rs("adminid")%>'">删除</a>｜<a href="purview.asp?act=purview&id=<%=Rs("adminid")%>&name=<%=Rs("username")%>" target="_blank">权限</a>｜<a href="log.asp?id=2&name=<%=Rs("username")%>">日志</a></td>
		</tr>


			<%
			Rs.movenext
			loop
			%>
          </table>
       </td>
      </tr>


 

    </table></td>
  </tr>
</table>
<%
case "edit"
set Rs=GrateRs("select * from H_admin where adminid="&adminid,1)
%>

            <tr>
                <td colspan="3" style="padding: 6px; height: 0px;">
                    <table cellspacing="0" cellpadding="0" width="100%" border="0"><form name="form1" method="post" action="admin.asp?action=upedit&adminid=<%=Rs("adminid")%>">
                        <tr>
                            <td align="left" colspan="2" height="34" style="height: 28px; background-color: aliceblue"
                                valign="middle">
                                &nbsp; <strong>基本资料 </strong>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" height="34" style="width: 180px; height: 28px" valign="middle"
                                class="leftTD dotted">
                                <span style="color: #cc0033">*</span>
                                用户名
                                &nbsp;</td>
                            <td height="34" valign="middle" width="*" class="dotted">
				<input type="hidden" name="old_inputusr" value='<%=Rs("username")%>'>
                                <input name="inputusr" type="text" class="inputbox" id="inputusr" value="<%=Rs("username")%>">
                                <span id="Label12" style="color:Gray;">给用户名一个易于标识的标题，20个字以内</span>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" height="34" style="width: 180px; height: 28px" valign="middle"
                                class="leftTD dotted">
                                <span style="color: #cc0033">*</span>
                                密
                                &nbsp;&nbsp;
                                码
                                &nbsp;</td>
                            <td height="34" valign="middle" width="*" class="dotted">
                                <input name="inputpwd" type="password" class="inputbox" id="inputpwd">
                                <span id="Label1" style="color:Gray;">密码由 6-20 个英文字母、数字或符号组成（如不需要更改新的密码，请保留）</span>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" height="34" style="width: 180px; height: 28px" valign="middle"
                                class="leftTD dotted">
                                <span style="color: #cc0033">*</span>
                                全登录省份
                                &nbsp;</td>
                            <td height="34" valign="middle" width="*" class="dotted">
				<input type="hidden" name="old_diqu" value='<%=Rs("diqu")%>'>
                                <input name="diqu" type="text" class="inputbox" id="diqu" value="<%=Rs("diqu")%>">
                                <span id="Label12" style="color:Gray;">全登录省份</span>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" height="34" style="width: 104px; height: 28px" valign="middle">
                            </td>
                            <td height="34" valign="middle" width="*">
                                <input name="Submit" type="submit" class="inputbutton" value=" 提交修改 "></td>
                        </tr>

          </table>
        </form></td>
      </tr>

    </table></td>
  </tr>
</table>
<%
case "addnew"
%>



            <tr>
                <td colspan="3" style="padding: 6px; height: 0px;">
                    <table cellspacing="0" cellpadding="0" width="100%" border="0"><form name="form1" method="post" action="admin.asp?action=upaddnew">
                        <tr>
                            <td align="left" colspan="2" height="34" style="height: 28px; background-color: aliceblue"
                                valign="middle">
                                &nbsp; <strong>基本资料 </strong>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" height="34" style="width: 180px; height: 28px" valign="middle"
                                class="leftTD dotted">
                                <span style="color: #cc0033">*</span>
                                用户名
                                &nbsp;</td>
                            <td height="34" valign="middle" width="*" class="dotted">
                                <input name="inputusr" type="text" class="inputbox" id="inputusr">
                                <span id="Label12" style="color:Gray;">给用户名一个易于标识的标题，20个字以内</span>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" height="34" style="width: 180px; height: 28px" valign="middle"
                                class="leftTD dotted">
                                <span style="color: #cc0033">*</span>
                                密
                                &nbsp;&nbsp;
                                码
                                &nbsp;</td>
                            <td height="34" valign="middle" width="*" class="dotted">
                                <input name="inputpwd" type="password" class="inputbox" id="inputpwd">
                                <span id="Label1" style="color:Gray;">密码由 6-20 个英文字母、数字或符号组成（如不需要更改新的密码，请保留）</span>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" height="34" style="width: 180px; height: 28px" valign="middle"
                                class="leftTD dotted">
                                <span style="color: #cc0033">*</span>
                                全登录省份
                                &nbsp;</td>
                            <td height="34" valign="middle" width="*" class="dotted">
                                <input name="diqu" type="text" class="inputbox" id="diqu">
                                <span id="Label12" style="color:Gray;">全登录省份</span>
                            </td>
                        </tr>
                        <tr>
                            <td align="right" height="34" style="width: 104px; height: 28px" valign="middle">
                            </td>
                            <td height="34" valign="middle" width="*">
                                <input name="Submit" type="submit" class="inputbutton" value=" 增加管理员 "></td>
                        </tr>

          </table>
        </form></td>
      </tr>

    </table></td>
  </tr>
</table>





<%
case "del"
set Rs=GrateRs("select * from H_admin where adminid="&adminid,3)
if not Rs.eof then 
Rs.delete
Rs.update

	'//修改记录信息//////////////////////////////////////////////////////////////////////////////////////
	log_Txt=""
	id = Request("adminid")
	log_Txt=log_Txt&"管理员ID："&id&" 删除;"
	'//END修改记录信息////////////////////////////////////////////////////////////////////////////////////
	
	
	Call WriteLog(""&log_Txt&"",2)
end if
response.write "<script language='JavaScript'>{window.alert('成功删除！');window.location='admin.asp?action=list';}</script>"
case "upaddnew"
set Rs=GrateRs("select * from H_admin",3)
if request.form("inputusr")<>"" and request.form("inputpwd")<>"" then 
Rs.addnew
Rs("username")=request.form("inputusr")
Rs("password")=md5(request.form("inputpwd"))
Rs("diqu")=request.form("diqu")
Rs.update

	'//修改记录信息//////////////////////////////////////////////////////////////////////////////////////
	log_Txt=""
	inputusr = Request("inputusr")
	diqu = Request("diqu")
	log_Txt=log_Txt&"添加管理员用户名："&inputusr&" 安全登陆省份："&diqu&";"
	'//END修改记录信息////////////////////////////////////////////////////////////////////////////////////
	
	
	Call WriteLog(""&log_Txt&"",2)

else
 response.write "<script language='JavaScript'>{window.alert('错误,管理员资料没有填完整！');window.location='admin.asp?action=list';}</script>"
end if
response.write "<script language='JavaScript'>{window.alert('添加成功！');window.location='admin.asp?action=list';}</script>"
case "upedit"
set Rs=GrateRs("select * from H_admin where adminid="&adminid,3)
if request.form("inputusr")<>"" then 
Rs("username")=request.form("inputusr")
Rs("diqu")=request.form("diqu")
if not request.form("inputpwd")="" then Rs("password")=md5(request.form("inputpwd"))

Rs.update


	
	'//修改记录信息//////////////////////////////////////////////////////////////////////////////////////
	log_Txt=""
	id = Request("adminid")
	inputusr = Request("inputusr")
	old_inputusr = Request("old_inputusr")
	diqu = Request("diqu")
	old_diqu = Request("old_diqu")
	If (old_inputusr<>inputusr) Then log_Txt=log_Txt&"管理员ID:"&id&"的用户名：由"&old_inputusr&"修改为"&inputusr&";"
	If (old_diqu<>diqu) Then log_Txt=log_Txt&"管理员ID:"&id&"的全登录省份：由"&old_diqu&"修改为"&diqu&";"
	if not request.form("inputpwd")="" Then log_Txt=log_Txt&"管理员ID:"&id&"的的密码：对密码进行了修改;"
	If (log_Txt="") Then log_Txt="没有进行信息修改。"
	'//END修改记录信息////////////////////////////////////////////////////////////////////////////////////
	
	
	Call WriteLog(""&log_Txt&"",2)


else
 response.write "<script language='JavaScript'>{window.alert('错误,管理员资料没有填完整！');window.location='admin.asp?action=list';}</script>"
end if
response.write "<script language='JavaScript'>{window.alert('修改成功！');window.location='admin.asp?action=list';}</script>"
case else
%>
<table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1" class="tablegg">
  <tr>
    <td><table width="100%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#F1F1F1">
        <tr bgcolor="#E3E2C3">
          <td height="23"><div align="center" class="style4">
            <div align="center" class="style4">管理员管理 </div>
          </div></td>
        </tr>
        <tr>
          <td height="84" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
              <tr bgcolor="#EDEDE1">
                <td height="26" colspan="2"><span class="forumRow">&nbsp;&nbsp;&nbsp;<strong>&nbsp;&nbsp;: : 系统错误 : :</strong></span></td>
              </tr>
              <tr bgcolor="#F1F1F1">
                <td width="10%" height="26" align="center">□</td>
                <td width="90%" height="26">您没有管理的权限或者您的登录已经超时，请重新<a href="index.asp" target="_parent">登录</a>！</td>
              </tr>
              <tr bgcolor="#F1F1F1">
                <td height="26" align="center">□</td>
                <td height="26">调用参数非法导致错误，请不要越权使用！</td>
              </tr>
          </table></td>
        </tr>
        <tr align="center" bgcolor="#EDEDE1">
          <td height="35" align="right"><span class="style1">Copyright 2003 - 2005 Cnzzd Inc. AllRights Reserved </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
        </tr>
    </table></td>
  </tr>
</table>
<%
end select
call DBConnEnd
%>
</body>
</html>