<?php
/*
乘风下载管理系统
作者QQ：178575
作者Email：yliangcf@163.com
作者网站：http://www.qqcf.com
详细简介：http://www.qqcf.com/cfdown.htm
上面有程序在线演示，安装演示，使用疑难解答，最新版本下载等内容
因为这些内容可能时常更新，就没有放在程序里，请自己上网站查看
*/
?>
<script src="../../js/ZeroClipboard.min.js"></script>

<?php 
$assort=ChkStr($_REQUEST["assort"],2);
$username=ChkStr($_REQUEST["username"],1);
$title=ChkStr($_REQUEST["title"],1);

$Px=ChkStr($_GET["Px"],1);
if($Px=="") $Px="id";



$PageUrl = "?action=$action&assort=$assort&username=$username&title=$title";
pxfilter($Px,"id,username,assort,title,filesize,viewnum,downnum,searchbotnum,idstr,pwd,listid,downsite,addtime,lasttime");
?>


<a href="?action=infoadd" class="actionBtn add" style="margin-top:10px;"><span>添加下载</span></a>


<script>
$(function(){

$("#search").click(function(){
 var searchurl ="?action=<?php echo $action;?>"
 searchurl += '&assort=' + $('#assort').val();
 searchurl += '&username=' + $('#username').val();
 searchurl += '&title=' + $('#title').val();
 location.href=searchurl;
});

});
</script>
<table style="margin-bottom:10px;">
    <tr>
      <td>
<select name="assort" id="assort">
<option value="">全部分类</option>
<?php 

$Sql="Select * From cfdown_infoclass order by id";
$Result2=mysql_query($Sql);
while ($Rs2=mysql_fetch_assoc($Result2))
{
?>
<option value="<?php echo $Rs2["id"];?>"<?php if ($assort==($Rs2["id"])) echo " selected";?>><?php echo $Rs2["infoclassname"];?></option>
<?php 
} 
?>
</select>
用户<input name="username" type="text" id="username" size="20" value="<?php echo $username;?>" />
标题<input name="title" type="text" id="title" size="20" value="<?php echo $title;?>" />
<input type="submit" name="submit" value="查询" class="btn" id="search" />

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


<table class="tb_2">
<tr>
<td>
<div class="explain">
点击标题可排序</div>
</td>
</tr>
</table>

<?php

$Sql="select count(1) from cfdown_info where 1=1";
$SqlWh="";
if($assort!="") $SqlWh.=" And assort=$assort";
if($title!="") $SqlWh.=" And title like '%$title%'";
if($username!="") $SqlWh.=" And username='$username'";

$Sql.=$SqlWh;

$Result=mysql_query($Sql);
$Rs=mysql_fetch_row($Result);
$Page=isset($_GET["Page"])&&intval($_GET["Page"])>0?intval($_GET["Page"]):1;
$PageSize=10;
$TotalRs=$Rs[0];
$TotalPage=ceil($TotalRs/$PageSize);
$Offset=$PageSize*($Page-1);

$Sql="select * from cfdown_info where 1=1";
$Sql.=$SqlWh;
$Sql.=" Order By $Px Desc limit $Offset,$PageSize";

$Result=mysql_query($Sql);
?>
<table class="tb_1">

  <tr class="tr_1"> 
    <td><a href="<?php echo $PageUrl?>&Px=id">ID</a></td>
    <td><a href="<?php echo $PageUrl?>&Px=username">用户</a></td>
    <td><a href="<?php echo $PageUrl?>&Px=assort">分类</a></td>
    <td><a href="<?php echo $PageUrl?>&Px=title">标题</a></td>
    <td><a href="<?php echo $PageUrl?>&Px=filesize">大小</a></td>
	<td><a href="<?php echo $PageUrl?>&Px=viewnum">浏览量</a></td>
    <td><a href="<?php echo $PageUrl?>&Px=downnum">下载量</a></td>
	<td><a href="<?php echo $PageUrl?>&Px=searchbotnum">爬虫量</a></td>    
    <td><a href="<?php echo $PageUrl?>&Px=idstr">缩短字符</a></td>
    <td><a href="<?php echo $PageUrl?>&Px=pwd">下载密码</a></td>
    <td><a href="<?php echo $PageUrl?>&Px=listid">置顶</a></td>
	<td><a href="<?php echo $PageUrl?>&Px=downsite">位置</a></td>
    <td><a href="<?php echo $PageUrl?>&Px=addtime">加入时间</a></td>
	<td><a href="<?php echo $PageUrl?>&Px=lasttime">最后访问时间</a></td>	
    <td>操作</td>
  </tr>
  <?php 
while ($Rs=mysql_fetch_assoc($Result))
{
?>
  <tr class="tr_2"> 
    <td><?php echo $Rs["id"];?></td>
    <td><?php echo $Rs["username"];?></td>
    <td>
<?php 
$Sql="Select * From cfdown_infoclass Where id=".$Rs["assort"];

$Result2=mysql_query($Sql);
if($Rs2=mysql_fetch_assoc($Result2)) echo $Rs2["infoclassname"];
?>    </td>

    <td style="width:320px;word-wrap: break-word;word-break:break-all;"><?php echo "<a href='../../s/".$Rs["idstr"]."' target='_blank'>".$Rs["title"]."</a>";?></td>
    <td><?php echo $Rs["filesize"];?></td>
	<td><?php echo $Rs["viewnum"];?></td>
    <td><?php echo $Rs["downnum"];?></td>
	<td><?php echo $Rs["searchbotnum"];?></td>
    <td><?php echo $Rs["idstr"];?></td>
    <td><?php echo $Rs["pwd"];?></td>
    <td><?php echo $Rs["listid"];?></td>
	<td><?php echo $Rs["downsite"];?></td>
    <td><?php echo date("m-d H:i",strtotime($Rs["addtime"]));?></td>
	<td><?php echo date("m-d H:i",strtotime($Rs["lasttime"]));?></td>
    <td>
      <a href="?action=infomodify&id=<?php echo $Rs["id"];?>" class="btn_edit"><i class="fa fa-edit"></i> 修改</a>
      <a href="javascript:;" onclick="$(function () { confirm('你确定要删除吗?', '', function (isConfirm) {if (isConfirm) {gotoUrl('?action=infodel&id=<?php echo $Rs["id"];?>')}}, {confirmButtonText: '确定', cancelButtonText: '取消', width: 400});});" class="btn_del"><i class="fa fa-times-circle"></i> 删除</a>

<textarea id="c<?php echo $Rs["id"]?>"  cols="1" rows="1" style='display:none'>
<?php
echo $Rs["title"]."的下载链接:";
echo $RootPath.'s/'.$Rs["idstr"];

if($Rs["pwd"]!=""){
echo " 提取码:";
echo $Rs["pwd"];
}
?>
</textarea>

<input type="button" value="复制短链接" id="cc<?php echo $Rs["id"]?>" data-clipboard-target="c<?php echo $Rs["id"]?>" class="btn">
<script type="text/javascript">
var clip = new ZeroClipboard( document.getElementById("cc<?php echo $Rs["id"]?>") );
</script>


<textarea id="d<?php echo $Rs["id"]?>"  cols="1" rows="1" style='display:none'>
<?php
echo $Rs["title"]."的下载链接:";
echo $RootPath.'s/show.php?idstr='.$Rs["idstr"];

if($Rs["pwd"]!=""){
echo " 提取码:";
echo $Rs["pwd"];
}
?>
</textarea>

<input type="button" value="复制长链接" id="dd<?php echo $Rs["id"]?>" data-clipboard-target="d<?php echo $Rs["id"]?>" class="btn">
<script type="text/javascript">
var clip = new ZeroClipboard( document.getElementById("dd<?php echo $Rs["id"]?>") );
</script>

</td>
  </tr>
  <?php 
} 
?>
</table>

<?php
ShowPage($TotalRs,$TotalPage,$Page,$PageUrl,$Px)
?>




