<?php 
if(!isset($_SESSION['admin_name'])){
   exit; 
}
?>
<div class="guanli">
<br>
<p style="padding-bottom:9px;font-size: 20px;font-weight: bold;color:#6A6A6A;">
分享传播推广管理
</p>
<form action="renwu/del_neirong.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>
<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>
<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>
<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 user_renwu";
$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;
$zhuan_sql="select * from user_renwu order by id limit {$offset},{$length}";
$zhuan_rst=mysql_query($zhuan_sql);


while($zhuan_row=@mysql_fetch_assoc($zhuan_rst)){
    echo "<tr align='center' style='height:50px;background:#FAFFFF;'>"; 
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 1px;'><input type='checkbox' name='checkbox[]' class='checkall' value='{$zhuan_row['id']}'/></td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>{$zhuan_row['id']}</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>{$zhuan_row['username']}</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>".mb_substr($zhuan_row['biaoti'],0,5,'utf-8')."..</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>".mb_substr($zhuan_row['wangzhi'],0,10,'utf-8')."..</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><span style='color:red'>{$zhuan_row['tiaozhuan']}</span>秒</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><span style='color:red'>{$zhuan_row['jiner']}</span>元</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><span style='color:red'>{$zhuan_row['yuer']}</span>元</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><span style='color:red'>{$zhuan_row['meijian']}</span>元</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><span style='color:red'>{$zhuan_row['jianshu']}</span>件</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><span style='color:red'>{$zhuan_row['shengyu']}</span>件</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>{$zhuan_row['jilian']}</td>";
    if($zhuan_row['jieshu']==0){echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;color:green;'>正常</td>";}else{
      echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;color:red;'>结束</td>";  
    } 
    
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'>".date("Y/m/d H:i:s",$zhuan_row['time'])."</td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><a href='renwu/yulan.php?aid={$zhuan_row['id']}' target='_blank'><img style='border:0px;' src='image/chakan.png'></a></td>";
    echo "<td style='border: 1px solid #C6D4E2;border-width:0px 1px 1px 0px;'><a class='update1' userid='{$zhuan_row['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='renwu/del_neirong.php?id={$zhuan_row['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?page=1'>首页</a>&nbsp;<a href='index.php?page={$prevpage}'>&lt;上一页</a>";
echo "&nbsp;<a style='color:#009999;' href='index.php?page={$pagenum}'>{$pagenum}</a>&nbsp;/&nbsp;<span>{$totpage}</span>";
echo "<a href='index.php?page={$nextpage}'>&nbsp;下一页&gt;</a>&nbsp;<a href='index.php?page={$totpage}'>尾页</a>";
echo "</p>";
@mysql_free_result($zhuan_rst);
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> 
