<?php
if(!isset($_SESSION['username'])){
   exit; 
}
?>
<div style='width:1050px;height:755px;background:#fff;'>
<center>
<br>
<p style="font-size: 20px;text-align: center;color:#676767;">我的账户明细</p>
<br/>
<table width="1000px" align="center" cellspacing="0" style="color:#676767;">
<tr style="background: #009999;height:30px;color:#fff;"><th>序号</th><th>提现金额</th><th>账户余额</th><th>审核状态</th><th>是否支付</th><th>提现时间</th></tr>
<?php
//查询用户id
$tixian_username="select id from user where username='{$username}'";
$tixian_username_rst=mysql_query($tixian_username);
$tixian_username_row=@mysql_fetch_row($tixian_username_rst);
$uid_sql="select * from user where username='{$username}'";
$uid_row=mysql_fetch_assoc(mysql_query($uid_sql));
//总行数
$length=10;
$mingxi_sql="select count(*) from tixian_shenhe where uid={$uid_row['id']}";
$mingxi_rst=mysql_query($mingxi_sql);
$mingxi_tot=@mysql_fetch_row($mingxi_rst);
//总页数
$totpage=ceil($mingxi_tot[0]/$length);
//当前页
$pagenum=@$_GET['page']?@$_GET['page']:1;
//限制最大页数
if($pagenum>=$totpage){$pagenum=$totpage;}
//offset算法
$offset=($pagenum-1)*$length;
$zhuansql="select * from tixian_shenhe where uid='{$tixian_username_row[0]}' order by id desc limit {$offset},{$length} ";
$zhuanrst=mysql_query($zhuansql);
$i=0;
//获取所有数据
while($zhuanrow=@mysql_fetch_assoc($zhuanrst)){
    $i++;
    echo "<tr align='center' style='height:50px;background:#fff;'>"; 
    echo "<td>";
    echo $i;
    echo "</td>";
    echo "<td>";
    echo "<span style='color:red;'>{$zhuanrow['tixianjiner']}</span>元";
    echo "</td>";
    echo "<td>";
    echo $zhuanrow['zonger']."元";
    echo "</td>";
    echo "<td>";
    if($zhuanrow['shifoutongguo']==0){
        echo "审核中...";
    }elseif($zhuanrow['shifoutongguo']==1){
        echo "<span style='color:#009999;'>审核通过</span>";
    }elseif($zhuanrow['shifoutongguo']==2){
        echo "<span style='color:red;'>审核未过</span>";
    }
    echo "</td>";
    
        echo "<td>";
    if($zhuanrow['shifouzhifu']==0){
        echo "<span style='color:red;'>未支付</span>";
    }else{
        echo "<span style='color:#009999;'>已支付</span>";
    }
    echo "</td>";
    
    echo "<td>";
    echo date("Y/m/d H:i:s",$zhuanrow['time']);
    echo "</td>";
    echo "</tr>";
    
}
echo "</table>";
//计算上一页和下一页
$prevpage=$pagenum-1;
$nextpage=$pagenum+1;
echo "<br/>";
echo "<p>";
echo "<a href='user_index.php?p=tixian_mingxi&page=1'>首页</a>&nbsp;<a href='user_index.php?p=tixian_mingxi&page={$prevpage}'>&lt;上一页</a>";
echo "&nbsp;<a style='color:#009999;' href='user_index.php?p=tixian_mingxi&page={$pagenum}'>{$pagenum}</a>&nbsp;/&nbsp;<span>{$totpage}</span>";
echo "<a href='user_index.php?p=tixian_mingxi&page={$nextpage}'>&nbsp;下一页&gt;</a>&nbsp;<a href='user_index.php?p=tixian_mingxi&page={$totpage}'>尾页</a>";
echo "</p>";
@mysql_free_result($zhuanrst);
@mysql_free_result($tixian_username_rst);
mysql_close($con);
?>
</center>
</div>