<html>
<head>
<META content=ywnt,云网互动影视管理系统 name=keywords>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>云网互动影视6.0--管理员管理</title>
<LINK href="css/css.css" type=text/css rel=stylesheet>
</head>
<BODY leftMargin=0 topMargin=0 scroll=yes MARGINHEIGHT="0" MARGINWIDTH="0">
<!--#include file="../Conn.asp" -->
<!--#include file="YWNT_TMS_inc/YWNT_TMS_Function.asp" -->
<!--#include file="YWNT_TMS_inc/YWNT_TMS_Page.asp" -->
<!--#include file="../Function/Md5.asp" -->
<%
'===================================================================================================================
'软件名称：云网影视管理系统
'Copyright (C) 2002-2007 ywnt.net  All rights reserved.
'产品咨询QQ：489234,2813712
'程序版权：云网互动科技有限公司
'程序开发：云网互动科技有限公司
'官方网站：http://www.ywnt.net 
'郑重声明:
'    1、免费版本请在程序首页保留版权信息，并做上本站LOGO友情连接,商业版本无此要求;
'    2、任何个人或组织不得在授权允许的情况下删除、修改、拷贝本软件及其他副本上一切关于版权的信息；
'    3、云网互动科技有限公司保留此软件的法律追究权利
'===================================================================================================================
Call CheckLogin("Admin")
sub EditSave()
		IF Request.Form("AdminName")="" Then
		call Admin_ShowErr("<li>管理员名称不能为空</li>","javascript:history.go(-1)",0)
		End IF
		IF Request.Form("AdminPassword")<>"" Then
		IF Request.Form("AdminPassword")<>Request.Form("AdminPassword2") Then
		call Admin_ShowErr("<li>两次管理员密码不一直</li>","javascript:history.go(-1)",0)
		End IF
		End IF
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Admin where ID="&NoSqlHack(Request.Form("ID"))
		Rs.open sql,Conn,1,3
		RS("AdminName")=NoSqlHack(Request.Form("AdminName"))
		IF Request.Form("AdminPassword")<>"" Then
		RS("AdminPassword")=NoSqlHack(Md5(Request.Form("AdminPassword"),32))
		End if
		RS("AdminGroup")=NoSqlHack(Request.Form("AdminGroup"))
		RS("AdminIPOff")=NoSqlHack(Request.Form("AdminIPOff"))
		RS("AdminIP")=NoSqlHack(Request.Form("AdminIP"))
		RS("AdminLocks")=NoSqlHack(Request.Form("AdminLocks"))
		RS("AdminNote")=NoSqlHack(Request.Form("AdminNote"))
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		Call AddLog("修改管理员"&Request.Form("AdminName"),1)
		call Admin_ShowErr("<li>管理员改成功</li>","Admin_Admin.asp",1)
end sub
sub AddSave()
		IF Request.Form("AdminName")="" Then
		call Admin_ShowErr("<li>管理员名称不能为空</li>","javascript:history.go(-1)",0)
		End IF
		IF Request.Form("AdminPassword")="" Then
		call Admin_ShowErr("<li>管理员密码不能为空</li>","javascript:history.go(-1)",0)
		End IF
		IF Request.Form("AdminPassword")<>Request.Form("AdminPassword2") Then
		call Admin_ShowErr("<li>两次管理员密码不一直</li>","javascript:history.go(-1)",0)
		End IF
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Admin where AdminName='"&NoSqlHack(Request.Form("AdminName"))&"'"
		Rs.open sql,Conn,1,3
		IF not Rs.eof then
		call Admin_ShowErr("<li>已经有此管理员名称</li>","javascript:history.go(-1)",0)
		else
		Rs.addnew
		RS("AdminName")=NoSqlHack(Request.Form("AdminName"))
		RS("AdminPassword")=NoSqlHack(Md5(Request.Form("AdminPassword"),32))
		RS("AdminGroup")=NoSqlHack(Request.Form("AdminGroup"))
		RS("AdminIPOff")=NoSqlHack(Request.Form("AdminIPOff"))
		RS("AdminIP")=NoSqlHack(Request.Form("AdminIP"))
		RS("AdminLocks")=NoSqlHack(Request.Form("AdminLocks"))
		RS("AdminNote")=NoSqlHack(Request.Form("AdminNote"))
		Rs.Update
		end if
		Rs.Close
		Set Rs = Nothing
		Call AddLog("添加管理员"&Request.Form("AdminName"),1)
		call Admin_ShowErr("<li>管理员添加成功</li>","Admin_Admin.asp",1)
end sub
sub Del()
	conn.execute "delete from YWNT_TMS_Admin WHERE ID="&NoSqlHack(Request("ID"))
	Call AddLog("删除管理员",1)
	call Admin_ShowErr("<li>管理员删除成功！</li>","Admin_Admin.asp",1)
end sub
sub SLocks()
	Conn.execute("Update YWNT_TMS_Admin set AdminLocks=1 where ID="&request.QueryString("ID")&"")
	Call AddLog("锁定管理员",1)
	call Admin_ShowErr("<li>管理员锁定成功！</li>",""&Request.ServerVariables("HTTP_REFERER")&"",1)
end sub
sub JLocks()
	Conn.execute("Update YWNT_TMS_Admin set AdminLocks=0 where ID="&request.QueryString("ID")&"")
	Call AddLog("解锁管理员",1)
	call Admin_ShowErr("<li>管理员解锁成功！</li>",""&Request.ServerVariables("HTTP_REFERER")&"",1)
end sub%>
<TABLE class=table cellSpacing=1 cellPadding=3 width="98%" align=center border=0>
  <TBODY>
    <TR>
      <TD class=xingmu colSpan=3>管理员管理</TD>
    </TR>
    <TR>
      <TD class="hback"><a href="Admin_Admin.asp">管理员首页</a> | <a href="Admin_Admin.asp?Action=Add">添加管理员</a> | <a href="Admin_Admin.asp?Action=LocksW">锁定的管理员</a></TD>
    </TR>
  </TBODY>
</TABLE>
<%Action=Trim(request.QueryString("Action"))
Select Case Action
Case "Add"
	call Add()
Case "AddSave"
	call AddSave()
Case "Edit"
		Set Rs=Server.CreateObject(YWNT_TMS_RS)
		sql="select * from YWNT_TMS_Admin where ID="&NoSqlHack(Request.QueryString("ID"))
		Rs.open sql,Conn,1,1
		YWNT_TMS_ID=RS("ID")
		YWNT_TMS_AdminName=RS("AdminName")
		YWNT_TMS_AdminGroup=RS("AdminGroup")
		YWNT_TMS_AdminIPOff=RS("AdminIPOff")
		YWNT_TMS_AdminIP=RS("AdminIP")
		YWNT_TMS_AdminLocks=RS("AdminLocks")
		YWNT_TMS_AdminNote=RS("AdminNote")
		RS.close   
      	set RS=nothing
	call Edit()
Case "EditSave"
	call EditSave()
Case "Del"
	call Del()
Case "SLocks"
	call SLocks()
Case "JLocks"
	call JLocks()
Case else
	call List()
End Select
sub List()
Dim int_RPP
	int_RPP=GetConfig("PageNumber") '设置每页显示数目%>
<TABLE class=table cellSpacing=1 cellPadding=3 width="98%" align=center border=0>
  <TBODY>
  <TR>
    <TD align="center" class=xingmu>管理员</TD>
    <TD width="15%" align="center" class=xingmu>管理员组</TD>
    <TD width="10%" align="center" class=xingmu>状态</TD>
    <TD width="25%" align="center" class=xingmu>操作</TD>
  </TR>
  <%Set Rs = server.CreateObject(YWNT_TMS_RS)
		sql="SELECT ID,AdminName,AdminGroup,AdminLocks FROM YWNT_TMS_Admin"
		if Request.QueryString("action")="LocksW" then
		sql=sql&" where AdminLocks=1 ORDER BY id DESC"
		else
		sql=sql&" ORDER BY id DESC"
		end if
		Rs.open sql,Conn,1,1
		if RS.eof then
		Response.Write"<tr><td colspan=""4"" height=40 class=""hback"">没有管理员</td></tr>"
		else
		Rs.PageSize=int_RPP
		cPageNo=NoSqlHack(Request.QueryString("Page"))
		If cPageNo="" Then cPageNo = 1
		If not isnumeric(cPageNo) Then cPageNo = 1
		cPageNo = Clng(cPageNo)
		If cPageNo>Rs.PageCount Then cPageNo=Rs.PageCount 
		If cPageNo<=0 Then cPageNo=1
		Rs.AbsolutePage=cPageNo 
		for i=1 to int_RPP
	 	if Rs.eof Then exit For%>
  <TR>
    <TD height=32 align="center" class="hback"><%=Rs("AdminName")%></TD>
    <TD align="center" class="hback"><%=WAdminGroup("GroupName",Rs("AdminGroup"))%></TD>
    <TD align="center" class="hback"><%IF Rs("AdminLocks")=1 Then Response.Write"锁定" Else Response.Write"正常" End IF%></TD>
    <TD align="center" class="hback"><A href="Admin_Admin.asp?Action=Edit&ID=<%=Rs("ID")%>">修改</A>｜<A href="Admin_Admin.asp?Action=Del&ID=<%=Rs("ID")%>">删除</A>｜<A href="Admin_Admin.asp?Action=SLocks&ID=<%=Rs("ID")%>">锁定</A>｜<A href="Admin_Admin.asp?Action=JLocks&ID=<%=Rs("ID")%>">解锁</A></TD>
  </TR>
  <%Rs.MoveNext
	next 
	end if%>
    	<tr align="right">
    <td height=32 colspan="9" class="hback"><% response.Write fPageCount(Rs,cPageNo) %></td>
	</tr>
	<%RS.close     
	set RS=nothing%>
  </TBODY></TABLE>
<%end sub
sub Add()%>
<TABLE class=table cellSpacing=1 cellPadding=3 width="98%" align=center border=0>
  <TBODY>
    <TR>
      <TD colspan="2" class=xingmu>添加管理员</TD>
    </TR>
    <form action="Admin_Admin.asp?Action=AddSave" method="post" name="form">
    <TR>
      <TD width="21%" height=32 align="right" class="hback">管理员用户名：</TD>
      <TD width="79%" class="hback"><input name="AdminName" type="text" size="40"></TD>
    </TR>
    <TR>
      <TD height=32 align="right" class="hback">管理员密码：</TD>
      <TD class="hback"><input name="AdminPassword" type="password" size="40"></TD>
    </TR>
    <TR>
      <TD height=32 align="right" class="hback">重复密码：</TD>
      <TD class="hback"><input name="AdminPassword2" type="password" size="40"></TD>
    </TR>
	    <TR>
      <TD height=32 align="right" class="hback">管理员组：</TD>
      <TD class="hback"><%Call LebGroup("AdminGroup","")%></TD>
    </TR>
    <TR>
      <TD height=32 align="right" class="hback">是/否绑定管理员IP：</TD>
      <TD class="hback"><input type="radio" name="AdminIPOff" value="1" onClick="showThumbnail_RateOrSize(1,'AdminIPW')">
        开启动管理员IP绑定&nbsp;&nbsp;&nbsp;
          <input name="AdminIPOff" type="radio" onClick="showThumbnail_RateOrSize(0,'AdminIPW')" value="0" checked>
      关闭动管理员IP绑定</TD>
    </TR>
    <TR id="AdminIPW" style="display:none">
      <TD height=32 align="right" class="hback">IP地址：</TD>
      <TD class="hback"><input name="AdminIP" type="text" size="40"><font onClick="checkIP();" style="cursor: pointer;">自动检测IP</font></TD>
    </TR>
    <TR>
      <TD height=32 align="right" class="hback">是/否被锁定：</TD>
      <TD class="hback"><select name="AdminLocks">
        <option value="0">不锁定&nbsp;&nbsp;</option>
        <option value="1">锁定&nbsp;&nbsp;&nbsp;</option>
      </select>      </TD>
    </TR>
    <TR>
      <TD height=32 align="right" class="hback">管理员介绍：</TD>
      <TD class="hback">
        <textarea name="AdminNote" cols="50" rows="5"></textarea></TD>
    </TR>
    <TR align="center">
      <TD height=32 colspan="2" class="hback"><input type="submit" name="Submit" value="添 加"></TD>
    </TR>
    </form>
  </TBODY>
</TABLE>
<%end sub
sub Edit()%>
<TABLE class=table cellSpacing=1 cellPadding=3 width="98%" align=center border=0>
  <TBODY>
    <TR>
      <TD colspan="2" class=xingmu>修改管理员</TD>
    </TR>
    <form action="Admin_Admin.asp?Action=EditSave" method="post" name="form">
    <TR>
      <TD width="21%" height=32 align="right" class="hback">管理员用户名：</TD>
      <TD width="79%" class="hback"><input name="AdminName" type="text" value="<%=YWNT_TMS_AdminName%>" size="40"></TD>
    </TR>
    <TR>
      <TD height=32 align="right" class="hback">管理员密码：</TD>
      <TD class="hback"><input name="AdminPassword" type="password" size="40" onChange="showThumbnail_RateOrSize(1,'WPassword')"></TD>
    </TR>
    <TR id="WPassword" style="display:none">
      <TD height=32 align="right" class="hback">重复密码：</TD>
      <TD class="hback"><input name="AdminPassword2" type="password" size="40"></TD>
    </TR>
	    <TR>
      <TD height=32 align="right" class="hback">管理员组：</TD>
      <TD class="hback"><%Call LebGroup("AdminGroup",YWNT_TMS_AdminGroup)%></TD>
    </TR>
    <TR>
      <TD height=32 align="right" class="hback">是/否绑定管理员IP：</TD>
      <TD class="hback"><input type="radio" name="AdminIPOff" value="1" onClick="showThumbnail_RateOrSize(1,'AdminIPW')" <%IF YWNT_TMS_AdminIPOff=1 Then Response.Write"checked"%>>
        开启动管理员IP绑定&nbsp;&nbsp;&nbsp;
          <input name="AdminIPOff" type="radio" onClick="showThumbnail_RateOrSize(0,'AdminIPW')" value="0" <%IF YWNT_TMS_AdminIPOff=0 Then Response.Write"checked"%>>
      关闭动管理员IP绑定</TD>
    </TR>
    <TR id="AdminIPW" style="display:none">
      <TD height=32 align="right" class="hback">IP地址：</TD>
      <TD class="hback"><input name="AdminIP" type="text" size="40" value="<%=YWNT_TMS_AdminIP%>"><font onClick="checkIP();" style="cursor: pointer;">自动检测IP</font></TD>
    </TR>
    <TR>
      <TD height=32 align="right" class="hback">是/否被锁定：</TD>
      <TD class="hback"><select name="AdminLocks">
        <option value="0" <%IF YWNT_TMS_AdminLocks=0 Then Response.Write"selected"%>>不锁定&nbsp;&nbsp;</option>
        <option value="1" <%IF YWNT_TMS_AdminLocks=1 Then Response.Write"selected"%>>锁定&nbsp;&nbsp;&nbsp;</option>
      </select>      </TD>
    </TR>
    <TR>
      <TD height=32 align="right" class="hback">管理员介绍：</TD>
      <TD class="hback">
        <textarea name="AdminNote" cols="50" rows="5"><%=YWNT_TMS_AdminNote%></textarea></TD>
    </TR>
    <TR align="center">
      <TD height=32 colspan="2" class="hback"><input name="ID" type="hidden" value="<%=YWNT_TMS_ID%>"><input type="submit" name="Submit" value="修 改"></TD>
    </TR>
    </form>
  </TBODY>
</TABLE>
<%end sub%>
<script language="javascript">
<%IF request.QueryString("Action")="Edit" Then
Response.Write"showThumbnail_RateOrSize("&YWNT_TMS_AdminIPOff&",'AdminIPW')" 
End IF%>
function showThumbnail_RateOrSize(param,pname)
{
	if(param==1)
	{
		document.getElementById(pname).style.display="block"
	}else
	{
		document.getElementById(pname).style.display="none"
	}
}
  function checkIP() 
{
	document.form.AdminIP.value="<%=UsersIP()%>";
}
  </script>
<%call connclose()%>
</BODY></HTML>
