<?php
session_start();
require('../conn.php');
require('../functions.php');
require('admin.php');
$page=$_GET['page'];
$row=$mysql->query("select * from `refererdata` order by `id` desc");
if(is_numeric($page)==false){
	$page=1;
}else{
	$page=$page+1;
}

//查看分享记录
$uid=guolv($_GET['uid']);
if(is_numeric($uid)){
	$row=$mysql->query("select * from `refererdata` where `uid`='{$uid}' order by `id` desc");
}

//删除单个记录
if(is_numeric($_GET['del_id'])){
	$del_id=guolv($_GET['del_id']);
	$mysql->execute("delete from `refererdata` where `id`='{$del_id}'");
	echo "<script>alert('删除成功');location.href='refererlist.php'</script>";
	exit;
}
?>

<?php include('head.php')?>    

    <div class="container-fluid">
        
        <div class="row-fluid">
		<?php
		include('left.php');
		?>
<div class="span9">
            <h1 class="page-title">IP统计</h1>
<!--			
<div class="btn-toolbar">
    <a href="#myModal" data-toggle="modal" class="btn">Delete</a>
  <div class="btn-group">
  </div>
</div>
-->
<div class="well">
    <div id="myTabContent" class="tab-content">
      <div class="tab-pane active in" id="home">
		<div class="well">
<div class="pull-right">
<button class="btn"><a href="refererlist.php">首页</a></button>
<button class="btn"><a href="?page=<?php echo $page?>">下一页</a></button>
</div>		
    <table class="table">
      <thead>
        <tr>
          <th>#</th>
          <th>用户ID</th>
		  <th>访问页面</th>
		  <th>IP</th>
		  <th>时间</th>
		  <th></th>
        </tr>
      </thead>
      <tbody>
<?php
$row_referer=page_array(50,$page,$row,0);
	  foreach($row_referer as $v_referer){
	  $time=date("Y-m-d H:i",$v_referer['time']);
print <<<table
        <tr>
          <td>{$v_referer['id']}</td>
          <td>{$v_referer['uid']}</td>
		  <td><a href="{$site}/detail.php?aid={$v_referer['aid']}" target="_blank">{$v_referer['title']}</a></td>
		  <td><a href="http://www.ip138.com/ips138.asp?ip={$v_referer['ip']}&action=2" target="_blank">{$v_referer['ip']}</a></td>
		  <td>{$time}</td>
		  <td><a class="btn btn btn-small" href="?del_id={$v_referer['id']}" title="删除"><i class="icon-trash"></i></a></td>
        </tr>
table;

	  }
	  ?>  
      </tbody>
    </table>
	<div class="pagination">
  <ul>
    <!--<li class="disabled"><a href="#">&laquo;</a></li>-->
  </ul>
</div>
</div>
      </div>
      <div class="tab-pane fade" id="profile">
      </div>
  </div>

</div>

        </div>
    </div>
    

    
    <footer>
        <hr>
        
        <p class="pull-right"><!--power by right--></p>
        
        
        <p><!--power by --></p>
    </footer>
    

    

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="lib/bootstrap/js/bootstrap.js"></script>
	


  </body>
</html>


