<!--#include file=../conn.asp-->
<!-- #include file="inc/const.asp" -->
<%Head()
	dim admin_flag
	admin_flag=",34,"
	if not master or instr(","&session("flag")&",",admin_flag)=0 then
		Errmsg=ErrMsg + "<BR><li>本页面为管理员专用，请<a href=../"&LoginUrl&" target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
		Call Ms_error()
	Else
		if request("action")="Toset" then
		call Toset()
		else
		call main()
		end if
		Footer()
	End If

sub main()
dim list
list=request("list")
strFileName="media.asp?list=" & Request("list") & ""
call tumppages()
dim sqlt
sqlt = " ID,Username,Title,Files,Howlong,hits,Checked,Addtime "%>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
  <tr> 
    <th height="23" colspan="8" class="tableHeaderText">影片管理中心</th>
  </tr>
  <tr> 
    <td height="26" colspan="8" class="forumrow"><a href="media.asp">首页</a> | 
      <a href="?list=1">动作片</a> | <a href="?list=2">喜剧片</a> | <a href="?list=3">爱情片</a> 
      | <a href="?list=4">恐怖片</a> | <a href="?list=5">战争片</a> | <a href="?list=6">科幻片</a> 
      | <a href="?list=7">综艺片</a> | <a href="?list=8">动画片</a> | <a href="?list=9">连续剧</a> 
      | <a href="?list=9">剧情片</a> | <a href="?list=10">其他</a> </td>
  </tr>
  <tr> 
    <th height="26" colspan="8" class="forumrow">所有影片列表</th>
  </tr>
  <FORM METHOD=POST ACTION="?action=Toset">
  <tr align="center"> 
    <td width="16%" class=forumRowHighlight>用户名</td>
    <td width="28%" class=forumRowHighlight>影片名称</td>
    <td width="9%" class=forumRowHighlight>格式</td>
    <td width="8%" class=forumRowHighlight>长度</td>
    <td width="9%" class=forumRowHighlight>人气</td>
    <td width="8%" class=forumRowHighlight>状态</td>
    <td width="16%" height="25" class=forumRowHighlight>上传时间</td>
    <td width="6%" height="25" class=forumRowHighlight>操作</td>
  </tr>
  <%set rs=server.createobject("adodb.recordset")
if list="" then
	Sql = "SELECT " & sqlt & " from Ms_media ORDER BY ID DESC"
	else
	Sql = "SELECT " & sqlt & " from Ms_media where typeid="&list&" ORDER BY ID DESC"
end if
		rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)%>
  <tr> 
    <td height="26" class="forumrow"><a href="admin_user.asp?action=modify&username=<%=rs(1)%>"><%=rs(1)%></a></td>
    <td height="26" class="forumrow"><a href=../media_view.asp?id=<%=rs(0)%> target="_blank"><%=rs(2)%></a></td>
    <td height="26" align="center" class="forumrow"><img src="../images/files/<%=rs(3)%>.gif" border=0></td>
    <td height="26" align="center" class="forumrow"><%=rs(4)%> 分钟</td>
    <td height="26" align="center" class="forumrow"><%=rs(5)%></td>
    <td height="26" align="center" class="forumrow"><%if rs(6)=0 then
	response.Write("<font color=red>未审</font>")
	else
	response.Write("<font color=blue>审核</font>")
	end if%></td>
    <td height="26" class="forumrow"><%=rs(7)%></td>
      <td height="26" align="center" class="forumrow">
<input type="checkbox" name="id" value="<%=rs(0)%>">
      </td>
  </tr>
  <%page_count=page_count+1
  rs.movenext
  loop
  end if
  if totalrec>0 then%>
    <tr align="center"> 
      <td height="24" colspan="8" class=forumrow> <%
		  	call showpage(strFileName)
		  %></td>
    </tr>
	<%end if%>
	<tr align="right"> 
      <td height="24" colspan="8" class=forumrow> 
        <input type="radio" name="paction" value=1>删除记录
	  <input type="radio" name="paction" value=2>影片操作
	  <select name="Pset">
	  <option value=1>审核</option>
	  <option value=0>解除</option>
	  </select>
全部选定<input type=checkbox value="on" name="chkall" onclick="CheckAll(this.form)">
      </td>
    </tr>
	<tr align="center"> 
      <td height="24" colspan="8" class=forumRowHighlight><input type=submit name=submit value="执行操作"  onclick="{if(confirm('确定执行操作吗?')){return true;}return false;}"></td>
    </tr>
</form>
</table>
<%end sub

sub Toset()
dim delid,fixid
	if request("paction")="" then
		response.write "<tr><td colspan=8 class=forumrow>请指定相关参数。</td></tr>"
		founderr=true
	end if
	delid=replace(request.form("id"),"'","")
	delid=replace(delid,";","")
	delid=replace(delid,"--","")
	delid=replace(delid,")","")
	fixid=replace(delid,",","")
	fixid=Trim(replace(fixid," ",""))
	If Not IsNumeric(fixid) Then
		response.write "<tr><td colspan=8 class=forumrow>请选择相关记录。</td></tr>"
		founderr=true
	End If
	if not founderr then
		if request("paction")=1 then''删除操作
				Conn.Execute("delete from Ms_media where id in ("&delid&")")
				Ms_suc("删除影片记录成功。")
		elseif request("paction")=2 then''审核操作
			Conn.Execute("update Ms_media set Checked="&Cint(request("Pset"))&" where id in ("&delid&")")''审核记录
			Ms_suc("审核/撤消成功。")
		else
			response.write "<tr><td colspan=8 class=forumrow>错误的参数。</td></tr>"
		end if
	end if
end sub%>