<?php
require("../../class/connect.php");
include("../../class/config.php");
include("../../class/db_sql.php");
include("../../class/q_functions.php");
include("../../class/user.php");
include("../../class/class.php");
include "../".LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//是否登陆
$user=islogin();
$userid=$_GET['userid'];
$page=(int)$_GET['page'];
$start=(int)$_GET['start'];
$line=25;//每页显示条数
$page_line=12;//每页显示链接数
$offset=$start+$page*$line;//总偏移量
$totalquery="select count(*) as total from {$dbtbpre}enewsdownrecord where userid='$user[userid]'";
$num=$empire->gettotal($totalquery);//取得总条数
$query="select * from {$dbtbpre}enewsdownrecord where userid='$user[userid]'";
$query=$query." order by truetime desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
$url="<a href=../../../>首页</a>&nbsp;>&nbsp;<a href=../cp>控制面板</a>&nbsp;>&nbsp;我的下载记录";
@include("../../data/template/cp_1.php");
?> 
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="15%" valign="top"> <table width="100%" border="0" cellpadding="3" cellspacing="1" class="tableborder">
        <tr class="header"> 
          <td height="23">消费记录</td>
        </tr>
        <tr> 
          <td height="23" bgcolor="#FFFFFF"><img src="../../data/images/msgnav.gif" width="5" height="5">&nbsp;<a href="../buybak">点卡充值记录</a></td>
        </tr>
        <tr> 
          <td height="23" bgcolor="#FFFFFF"><img src="../../data/images/msgnav.gif" width="5" height="5">&nbsp;<a href="../downbak">下载消费记录</a></td>
        </tr>
      </table></td>
    <td width="1%" valign="top">&nbsp;</td>
    <td width="84%" valign="top"> <div align="center">
        <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
          <tr class="header"> 
            <td width="55%" height="25"><div align="center">标题</div></td>
            <td width="16%" height="25"><div align="center">扣除点数</div></td>
            <td width="29%" height="25"><div align="center">时间</div></td>
          </tr>
  <?php
  while($r=$empire->fetch($sql))
  {
	if(empty($class_r[$r[classid]][tbname]))
	  {continue;}
	$nr=$empire->fetch1("select title,titleurl,groupid,filename,newspath,classid from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]." where id='$r[id]'");
	//标题链接
	$titlelink=sys_ReturnBqTitleLink($nr);
	if($r['online']==0)
	{
		$type='下载';
	}
	elseif($r['online']==1)
	{
		$type='观看';
	}
	elseif($r['online']==2)
	{
		$type='查看';
	}
  ?>
          <tr bgcolor="#FFFFFF"> 
            <td height="25"><div align="center">[<?=$type?>] &nbsp;<a href='<?=$titlelink?>' target='_blank'> 
                <?=$r[title]?>
                </a> </div></td>
            <td height="25"><div align="center"> 
                <?=$r[cardfen]?>
              </div></td>
            <td height="25"><div align="center"> 
                <?=date("Y-m-d H:i:s",$r[truetime])?>
              </div></td>
          </tr>
          <?
  }
  db_close();
  $empire=null;
  ?>
          <tr bgcolor="#FFFFFF"> 
            <td height="25" colspan="3"> 
              <?=$returnpage?>
            </td>
          </tr>
        </table>
      </div></td>
  </tr>
</table>
<?
@include("../../data/template/cp_2.php");
?>