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

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


$PageUrl = "?action=$action&infoid=$infoid";
?>



<script>
$(function(){

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

});
</script>
<table style="margin-bottom:10px;">
<tr> 
<td>
<select id='infoid' name="infoid">

<option value="">全部下载</option>
<?php 
$Sql="Select min(b.title) as title,a.infoid From cfdown_count_day a inner join cfdown_info b on a.infoid=b.id Where 1=1 Group By a.infoid Order By a.infoid";
$Result=mysql_query($Sql);
while ($Rs=mysql_fetch_assoc($Result))
{
  echo "<option value='".$Rs["infoid"]."'";
  if (ChkStr($_REQUEST["infoid"],2)==($Rs["infoid"])) echo " selected";
  echo ">".$Rs["title"]."[".$Rs["infoid"]."]</option>";
}
?>
</select>
<input type="submit" name="submit" value="查询" class="btn" id="search" />
</td>
</tr>
</table>


<table class="tb_2">
<tr>
<td><span class="title">每日报表 <?php if($infoid!="") echo "下载ID：$infoid";?></span></td>
</tr>


<tr>
<td>
<div class="explain">
列表里注括号内的数字为显示给广告主的实际数字</div>
</td>
</tr>

</table>

<?php

$Sql="Select a.adddate,".chr(10);
$Sql=$Sql."Sum(a.viewnum) viewnum,".chr(10);
$Sql=$Sql."Sum(a.downnum) downnum,".chr(10);
$Sql=$Sql."Sum(a.searchbotnum) searchbotnum ".chr(10);

$Sql=$Sql."From cfdown_count_day a inner join cfdown_info b on a.infoid=b.id Where 1=1".chr(10);

if ($infoid!="") $Sql=$Sql." And a.infoid=".$infoid;

$Sql=$Sql." Group By a.adddate Order By a.adddate Desc";


$Result=mysql_query($Sql);
$TotalRs=mysql_num_rows($Result);
$PageSize=15;
$TotalPage=ceil($TotalRs/$PageSize);
$Page=isset($_GET["Page"])&&intval($_GET["Page"])>0?intval($_GET["Page"]):1;
$Offset=($Page-1)*$PageSize;
@mysql_data_seek($Result, $Offset);
?>

<table class="tb_1">

  <tr class="tr_1"> 
    <td>日期</td>
    <td>页面PV</td>
    <td>下载PV</td>
	<td>爬虫PV</td>
    <td>&nbsp;</td>
  </tr>
  <?php 
for ($i=0; $i <$PageSize ; $i++){
if ($Rs=mysql_fetch_assoc($Result)){
?>
  <tr> 
    <td><?php echo $Rs["adddate"];?></td>
    <td><?php echo $Rs["viewnum"];?></td>
    <td><?php echo $Rs["downnum"];?></td>
	<td><?php echo $Rs["searchbotnum"];?></td>
    <td><a href="?action=daytjdetail&adddate=<?php echo $Rs["adddate"];?>" class="btn_add"><i class="fa fa-eye"></i> 详细</a>
    </td>
  </tr>
<?php 
}
}
?>
</table>

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

