<?php 
if(!isset($_SESSION['admin_name'])){
   exit; 
}
?>
<div style="text-align: center;">
<p style="padding-bottom:9px;font-size: 20px;font-weight: bold;color:#6A6A6A;">
<br>
会员账户
</p>
<div>
<form action="tixian/del_zonger.php" method="get" id="form1">
<table style="width:1020px;margin:0 auto;" cellspacing="0">
<tr style="background: #009999;height: 30px;">
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 1px;color: #fff;">全选</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px; color: #fff;">ID</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px;color: #fff;">会员名称</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px;color: #fff;">账户总额</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px;color: #fff;">修改</td>
<td style="font-weight: bold;border: 1px solid #BCBCBC;border-width:0px 1px 1px 0px;color: #fff;">删除</td>
</tr>
<?php
$length=10;
$totsql="select count(*) from tb_tot";
$totrst=mysql_query($totsql);
$totarr=mysql_fetch_row($totrst);
//总页数
$totpage=ceil($totarr[0]/$length);
//当前页
$pagenum=@$_GET['page']?@$_GET['page']:1;
//限制最大页数
if($pagenum>=$totpage){$pagenum=$totpage;}
//offset算法
$offset=($pagenum-1)*$length;
$usersql="select * from tb_tot order by id desc limit {$offset},{$length}";
$userrst=mysql_query($usersql);

$i=0;
while($userrow=@mysql_fetch_assoc($userrst)){
    $i++;
    if($i%2==0){echo "<tr style='background:#FDFDFD;'>";}else{echo "<tr>";}
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 1px;'><input type='checkbox' name='checkbox[]' class='checkall' value='{$userrow['id']}'/></td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>{$i}</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>{$userrow['username']}</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><span style='color:red;'>{$userrow['jiage']}</span>元</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><a class='xg_zonger_class' xg_zonger_data='{$userrow['id']}' href='javascript:;'><img style='border:0px;' src='image/gai.png'></a></td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><a href='tixian/del_zonger.php?id={$userrow['id']}&hid=1' onclick=\"c=confirm('确定删除吗？');if(!c){return false;}\"><img style='border:0px;' src='image/shan.png'></a></td>";
    echo "</tr>";
}
$prevpage=$pagenum-1;
$nextpage=$pagenum+1;
?> 

</table>
<input type="hidden" name="hid" value="2"/>

<p><input style="margin:20px 0px 0px 0px;" type="checkbox" name="all" onclick="check_all(this,'checkbox[]')" />
<span >全选</span>&nbsp;<input onclick="var b=confirm('确定要删除吗？');if(!b){return false;}" type="submit" value="全部删除"/></p>
</form>
<br/>
<?php
echo "<p>";
echo "<a href='index.php?ye=user_zonger&page=1'>首页</a>&nbsp;<a href='index.php?ye=user_zonger&page={$prevpage}'>&lt;上一页</a>";
echo "&nbsp;<a style='color:#009999;' href='index.php?ye=user_zonger&page={$pagenum}'>{$pagenum}</a>&nbsp;/&nbsp;<span>{$totpage}</span>";
echo "<a href='index.php?ye=user_zonger&page={$nextpage}'>&nbsp;下一页&gt;</a>&nbsp;<a href='index.php?ye=user_zonger&page={$totpage}'>尾页</a>";
echo "</p>";
@mysql_free_result($userrst);
mysql_free_result($totrst);
mysql_close($con);
?>
</div>
</div>
<script>
function check_all(obj,cName) 
{ 
    var checkboxs = document.getElementsByName(cName); 
    for(var i=0;i<checkboxs.length;i++){checkboxs[i].checked = obj.checked;} 
}
</script>