<!--#include file="../conn/conn1.asp"-->
<!--#include file="inc.asp"-->
<!--#include file="../config.asp"-->

<%
if request("act")="best" then
id =request("id")
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from film where id="&id
rs.open sql,Conn,1,3

if rs("best")=True then 
rs("best")=False
else
rs("best")=True
end if
rs.update
rs.close
set rs=nothing%>
<script language="javascript">
window.history.back();
location.reload();
</script>

<%
end if
%>



<%
if request("act")="indexbest" then
id =request("id")
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from film where id="&id  
rs.open sql,Conn,3,3
if rs("tj")=1 then 
rs("tj")=0
else
rs("tj")=1
end if
rs.update
rs.close
set rs=nothing%>
<script language="javascript">
window.history.back();
location.reload();
</script>

<%
end if
%>


<%
typeid=request("typeid")
   dim keyword
   keyword=request("keyword")
Set filmtype= Server.CreateObject("ADODB.Recordset") 
strSql="select * from type"
filmtype.open strSql,Conn,1,1 
%>
<script language="JavaScript">
<!--
function  validate()
    {
       
        if  (document.myform.type.value=="")
        {
            alert("新加类型不能为空");
            document.myform.type.focus();
            return false ;
        }
		}

function cform(){
 if(!confirm("你是否确认删除该类型？"))
 return false;

}
 -->
</script>

<link rel="stylesheet" type="text/css" href="../css/style.css">
<title>管理视频</title>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<center>
  <table width="95%" border="0" cellspacing="0" cellpadding="0" align=center>
    <tr>
      <td width="50%" valign="top"><table width="100%" height="20" border="0" cellpadding="0" cellspacing="0" bgcolor="#660066">
          <tr align=center>
            <td><font color="#FFFFFF">最新加入视频</font></td>
            <form method=POST action="mimi.asp"><td valign="middle" >
                <font color="#FFFFFF">视频搜索： </font>
                <input type="text" name=keyword size=20 maxlength="30" style="font-size:9pt;border-left: 1px solid #000000; border-right: 1px solid #000000; border-top: 1px solid #000000; border-bottom: 1px solid #000000">
                <input name=Image1 type="submit" id=Image1 title="查询" value="搜索" align="absmiddle" width="20" height="20" tppabs=""></td>
            </form>
            <td align=center><a href="addfilm.asp"><font color="#FFFFFF">添加视频</font></a></td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td><div style="width:100%; text-align:center; background:#99CC00">
          <% sql="select * from type"
			  Set rs2 = Server.CreateObject("ADODB.Recordset")
			  rs2.open sql,conn,1,1
			  do while not (rs2.eof or rs2.bof)
			  %>
          <a href="mimi.asp?typeid=<%=rs2("typeid")%>"><%=rs2("type")%></a>　|
        <%rs2.movenext 
loop 
rs2.close
set rs2=nothing
%>
        </div>
          <%
dim page
page=request("page")
PageSize = 18
dim rs,strSQL,news
if typeid="" then
strSQL ="SELECT * FROM film where title like '%"&keyword&"%'  ORDER BY id desc,best asc,dateandtime DESC"
else
strSQL ="SELECT * FROM film where title like '%"&keyword&"%' and typeid="&typeid&" ORDER BY id desc, best asc,dateandtime DESC"
end if
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSQL,Conn,3,3
    rs.PageSize = PageSize
	totalfilm=rs.recordcount
    pgnum=rs.Pagecount
    if page="" or clng(page)<1 then page=1
    if clng(page) > pgnum then page=pgnum
    if pgnum>0 then rs.AbsolutePage=page
if rs.eof then
response.write "<font color='#ffffff' class='3dfont'>没有视频提供观看</font>"
else
%>
          <table width=100% >
            <%
count=0 
do while not (rs.eof or rs.bof) and count<rs.PageSize 
%>
            <tr onMouseOut="this.style.backgroundColor='#f3f3f3'" onMouseOver="this.style.backgroundColor='#BFDFFF'">
              <td style="padding-left:5pt"><a href="../dvshow.asp?id=<%=rs("id")%>" target="_blank"><%=rs("title")%></a>
              <%
						
						if rs("best")="True" then 
						response.Write("<span style='color:#FBC0C0'>[推荐]</span>")
						end if
						
						%></td>
              <td align=center><a
    href="editfilm.asp?id=<%=rs("id")%>">修改</a></td>
              <td align=center><a
    href="delete.asp?id=<%=rs("id")%>">删除</a></td>
              <td align=center><%
						if rs("best")="True" then 
						%>
                [<a href='mimi.asp?act=best&id=<%=rs("id")%>'><span style='color:#ff0000'>取消推荐</span></a>]
                <%else%>
                [<a href='mimi.asp?act=best&id=<%=rs("id")%>'><span >推荐该片</span></a>]
                <%end if
						%>
                <% tjid= rs("id")
strSQLq ="SELECT * FROM film where id="&tjid
Set bentop = Server.CreateObject("ADODB.Recordset")
bentop.open strSQLq,Conn,1,3
if not bentop.eof then
%>
                <% 
if bentop("tj")=1 then
 %>
                [<a href='mimi.asp?act=indexbest&id=<%=rs("id")%>'><span style='color:#ff0000'>取消首页推荐</span></a>]
                <%else%>
                [<a href='mimi.asp?act=indexbest&id=<%=rs("id")%>'><span >首页推荐</span></a>]
                <%end if%>
                <%end if%>              </td>
            </tr>
            <%rs.movenext 
count=count+1
loop 
end if%>
        </table>
        <table border="0" cellspacing="0" cellpadding="0" width="100%">
            <tr >
              <td ><form method=Post action="mimi.asp">
                [共<b><%=rs.pagecount%></b>页] [第<%=page%>页]  [<%=pagesize%>部/页]  [共<%=totalfilm%>部]
                <%if page=1 then%>
                [首 页] [上一页]
                <% else %>
                [<a href="mimi.asp?page=1&typeid=<%=typeid%>">首 页</a>] 
                [<a href="mimi.asp?page=<%=page-1%>&typeid=<%=typeid%>">上一页</a>]
                <%end if%>
                                <%if rs.pagecount-page<1 then%>
                [下一页] [尾 页]
                <%else%>
                [<a href="mimi.asp?page=<%=page+1%>&typeid=<%=typeid%>">下一页</a>]  [<a href="mimi.asp?page=<%=rs.pagecount%>&typeid=<%=typeid%>">尾 页</a>]
                <%end if%>
                <input type='text' name='page' size=2 maxlength=10 style="font-size:9pt;border-left: 1px solid #000000; border-right: 1px solid #000000; border-top: 1px solid #000000; border-bottom: 1px solid #000000" value="<%=page%>" align=center>
                <input name="submit" type='submit' style="border:1 solid black;FONT-SIZE: 9pt; FONT-STYLE: normal; FONT-VARIANT: normal; FONT-WEIGHT: normal; HEIGHT: 18px; LINE-HEIGHT: normal"  value=' Goto '   size=2>
                <input name="hidden" type="hidden" value="<%=typeid%>">
              </form></td>
            </tr>
        </table>
        <%rs.close
set rs=nothing
%>
      </td>
    </tr>
  </table>
</center>
