<?php
require_once("../check.php");
require_once("../../config.php");
ini_set("date.timezone","PRC");
isset($_GET['date1'])?$date1=$_GET['date1']:$date1=null;//
isset($_GET['date2'])?$date2=$_GET['date2']:$date2=null;//
if($date1!=null and $date2!=null){
    $wherepage = "&date1=$date1&date2=$date2";
    $dates1 = strtotime($date1." 00:00:00");
    $dates2 = strtotime($date2." 23:59:59");
    $where = "and time>'$dates1' and time < '$dates2'";
}else{
    $wherepage = null;
    $where = null;
}
isset($_GET['page'])?$page=$_GET['page']:$page="1";//当前页数
$m="10";//每页显示的记录数
$numsql = "select count(id) as num from dunling_share where leixing='share' and youxiao='0' $where";
$numery = mysql_query($numsql,$config);
$numery = mysql_fetch_array($numery);
$zongjilushu = $numery['num'];//总记录数
$zy = (int)(($zongjilushu-1)/$m)+1;//总页数
$one = (int)($page-1)*$m;//当前页的首条记录
$articlesql = "select * from dunling_share where leixing='share' and youxiao='0' $where order by id desc limit $one,$m";
$articleery = mysql_query($articlesql,$config);
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script src="../js/jquery-1.11.1.min.js"></script>
<script src="../date/jquery.cxcalendar.js"></script>
<link rel="stylesheet" href="../date/jquery.cxcalendar.css"/>
</head>
<body>
<script>
$(function(){
   $(".username").click(function(){
    var id = $(this).text();
    $.post("../core/userid.php",{
        id:id
    },function(a,b){
        alert(a);
    });
   });

});

</script>
<style>
body{
    margin:0;
    padding:0;
    text-align:left;
}
#table{
    margin-left:20px;
    width:auto;
    max-width:1000px;
    min-height:35px;
    height:auto;
    display: table;
    line-height:35px;
    text-align:left;
    color: #505050;
    border-bottom:1px dashed #C9C9C9;
    font-size:14px;
}
#table:hover{
    background-color: #DDEEFF;
}
#table .id{
    width:80px;
    height:35px;
    line-height:35px;
    text-align:center;
    float:left;
}
#table .username{
    width:100px;
    height:35px;
    line-height:35px;
    text-align:left;
    float:left;
}
#table .ip{
    width:105px;
    height:35px;
    line-height:35px;
    text-align:center;
    float:left;
}
#table .urlid{
    width:250px;
    height:35px;
    line-height:35px;
    text-align:center;
    float:left;
}
#table a{
    text-decoration:none;
    color:#FF0000;
}
#table .time{
    width:110px;
    height:35px;
    line-height:35px;
    text-align:center;
    float:left;
}
#table .money{
    width:80px;
    height:35px;
    line-height:35px;
    text-align:center;
    float:left;
}
#table .moblieos{
    width:200px;
    height:35px;
    line-height:35px;
    text-align:center;
    float:left;
}


.del{
    color: #00791F;
}
.del:hover{
    color: #FF4646;
    cursor:pointer;
}

#p{
    margin-top:25px;
    margin-left:20px;
    width:auto;
    max-width:950px;
    min-height:50px;
    height:auto;
    display: table;
    line-height:50px;
    text-align:left;
    color: #505050;
    font-size:14px;
}
#p .page{
    width:950px;
    height:50px;
    line-height:50px;
    text-align:right;
}

#p .page li{
    text-align:center;
    display:inline;
    margin:0 5px 0 0px;
    float:left;
    height:50px;
}


#p .page li a{
    border-radius:3px;
    text-decoration: none;
    font-size:14px;
    color:#08246B;
    display: block;
    line-height: 30px;
    height:30px;
    padding-left: 12px;
    padding-right:12px;
    border:1px solid #08246B;
    box-shadow:0px 0px 3px 3px #DFDFDF;
}
#p .page li a:hover{
    border-radius:3px;
    width:auto;
    text-decoration: none;
    font-size:14px;
    color:#FFFFFF;
    display:table;
    line-height: 30px;
    height:30px;
    padding-left: 12px;
    padding-right:12px;
    background-color:#08246B;
}
#p .page li.dangqianye a{
    border-radius:3px;
    text-decoration: none;
    font-size:14px;
    color:#FFFFFF;
    display: block;
    line-height: 30px;
    height:30px;
    width:auto;
    padding-left: 12px;
    padding-right:12px;
    border:1px solid #08246B;
    background-color: #08246B;
}
.date{
    width:120px;
    height:20px;
    line-height:20px;
    text-align:center;
    color: green;
    font-weight:bold;
    background:url(../date/cxcalendar.png) no-repeat right;
}
#so{
    height:30px;
    line-height:30px;
    font-size:14px;
    color: red;
    margin-left:20px;
}
#form{
    margin:0;
    padding:0;
}
</style>
<div id="so"><form method="GET" action="kouliang_log.php">按日期搜索:<input value="<?php echo $date1;?>" name="date1" id="date1" class="date" type="text" data-position="bottom" readonly="" /> - <input value="<?php echo $date2;?>" name="date2" class="date" id="date2" type="text" data-position="bottom" readonly="" /> <input type="submit" value="查询" /></form></div>
<div id="table">
<div class="id"><strong>ID</strong></div>
<div class="username"><strong>会员UID</strong></div>
<div class="ip"><strong>访客IP</strong></div>
<div class="time"><strong>访问时间</strong></div>
<div class="money"><strong>节省拥金</strong></div>
<div class="moblieos"><strong>系统</strong></div>
<div class="urlid"><strong>阅读文章</strong></div>
</div>
<?php
while($list = mysql_fetch_array($articleery)){
$id = $list['id'];
$uid  = $list['uid'];
$ip  = $list['ip'];
$moblieos = $list['moblieos'];
$agent = $list['agent'];
$time = $list['time'];
$time =  date("m-d H:i",$time);
$urlid = $list['urlid'];
$title = $list['title'];
$title = mb_substr($title,0,15,'UTF-8');
$money = $list['danjia'];

?>
<div id="table">
<div class="id"><?php echo $id;?></div>
<div class="username"><?php echo $uid;?></div>
<div class="ip"><?php echo $ip;?></div>
<div class="time"><?php echo $time;?></div>
<div class="money"><?php echo $money;?></div>
<div class="moblieos" title="<?php echo $agent;?>"><?php echo $moblieos;?></div>
<div class="urlid"><a href="../../a/?read=<?php echo $urlid;?>_<?php echo $id;?>" target="_blank"><?php echo $title;?></a></div>
</div>
<?
}
?>
<div id="p">
<div class="page">
<?php
$shangyiye = $page-"1".$wherepage;
$xiayiye = $page+"1".$wherepage;
if($page>"1"){
        echo '<li><a href="?page='.$shangyiye.'">上一页</a></li>';
        echo '<li><a href="?page=1">1</a></li>';
}
if($page>="6"){
for($pagea=$page-4;$pagea<=$page-1;$pagea++){
        echo '<li><a href="?page='.$pagea.$wherepage.'">'.$pagea.'</a></li>';
}
}
echo '<li class="dangqianye"><a href="?page='.$page.$wherepage.'">'.$page.'</a></li>';

     
if(($zy-$page)>="5"){
for($pageb=$page+1;$pageb<=$page+4;$pageb++){
        echo '<li><a href="?page='.$pageb.$wherepage.'">'.$pageb.'</a></li>';
}
}

if("5">=($zy-$page)){
for($pagec=$page+1;$pagec<=$zy-1;$pagec++){
        echo '<li><a href="?page='.$pagec.$wherepage.'">'.$pagec.'</a></li>';
}
}

if($page<$zy){
        echo '<li><a href="?page='.$zy.$wherepage.'">..'.$zy.'</a></li>';
        echo '<li><a href="?page='.$xiayiye.'">下一页</a></li>';
}
?>
</div>
</div>
<script>
$(function(){
    $('#date1').cxCalendar();
    $('#date2').cxCalendar();
});
</script>
</body>