<?php
session_start();
error_reporting(0);
header("content-type:text/html;charset=utf-8");
date_default_timezone_set("PRC");
$str=false;
include "../myadmin/sql.php";
include "../inc/ur.php";

isset($_GET['uid'])?$uid=(int)$_GET['uid']:exit;
isset($_GET['aid'])?$aid=(int)$_GET['aid']:exit;


$ip_qingkong_sql="select time from ip limit 1";
$ip_qingkong_rst=mysql_query($ip_qingkong_sql);
$ip_qingkong_row=mysql_fetch_assoc($ip_qingkong_rst);
$today_db=$ip_qingkong_row['time'];
$today=date("Ymd",time());
if($today!=$today_db){
    $ip_shanchu_sql="delete from ip where time!='{$today}'";
    mysql_query($ip_shanchu_sql);
}



$ip_yanzheng="select * from ip where iptot='{$ip}'";
$ip_rst=mysql_query($ip_yanzheng);


$user_renwu_danjia="select * from user_renwu where id=".$aid;
$user_renwu_rst=mysql_query($user_renwu_danjia);
$user_renwu_row=mysql_fetch_assoc($user_renwu_rst);
$meijian=$user_renwu_row['meijian'];

$tot_sql="select * from tb_tot where uid=".$uid;
$tot_rst=mysql_query($tot_sql);
$tot_row=mysql_fetch_assoc($tot_rst);
$tb_tot_jiage=$tot_row['jiage'];
$jiage_tot=$tb_tot_jiage+$meijian;

if(mysql_num_rows($ip_rst)==0 && $user_renwu_row['jieshu']==0){
 
   if($user_renwu_row['jilian']!="全国"){
       $jilian_arr=array("jilian"=>$user_renwu_row['jilian']);
       if(in_array($ip_js['data']['region'],$jilian_arr)){
           
       $user_mingxi_sql="insert into user_mingxi(ip,dizhi,jiage,uid,time,time2) values ('{$ip}','{$dizhi}','{$meijian}',".$uid.",".time().",".date("Ymd",time()).")";
 
       mysql_query($user_mingxi_sql);
      
      
    
       $jisuan_jiner=$user_renwu_row['yuer']-$user_renwu_row['meijian'];
       $jisuan_jianshu=$user_renwu_row['shengyu']-1;
       $jisuan_update="update user_renwu set yuer='{$jisuan_jiner}',shengyu='$jisuan_jianshu' where id={$user_renwu_row['id']}";
       mysql_query($jisuan_update);
      
       if($user_renwu_row['shengyu']==1){
           $jieshu_sql="update user_renwu set jieshu='1' where id={$user_renwu_row['id']}";
           mysql_query($jieshu_sql);
       }

 
       $tb_tot_update="update tb_tot set jiage='{$jiage_tot}' where uid=".$uid;
       mysql_query($tb_tot_update);  
           
           
       } 
   }else{
        
       
       $user_mingxi_sql="insert into user_mingxi(ip,dizhi,jiage,uid,time,time2) values ('{$ip}','{$dizhi}','{$meijian}',".$uid.",".time().",".date("Ymd",time()).")";
 
       mysql_query($user_mingxi_sql);
      
  
    
       $jisuan_jiner=$user_renwu_row['yuer']-$user_renwu_row['meijian'];
       $jisuan_jianshu=$user_renwu_row['shengyu']-1;
       $jisuan_update="update user_renwu set yuer='{$jisuan_jiner}',shengyu='$jisuan_jianshu' where id={$user_renwu_row['id']}";
       mysql_query($jisuan_update);
   
       if($user_renwu_row['shengyu']==1){
           $jieshu_sql="update user_renwu set jieshu='1' where id={$user_renwu_row['id']}";
           mysql_query($jieshu_sql);
       }


       $tb_tot_update="update tb_tot set jiage='{$jiage_tot}' where uid=".$uid;
       mysql_query($tb_tot_update); 
   }    

       $ip_insert="insert into ip(iptot,uid,time) values('{$ip}',".$uid.",".date("Ymd",time()).")";
       mysql_query($ip_insert);  
} 



$xianshi_sql="select * from user_renwu where id=".$aid;
$xianshi_rst=mysql_query($xianshi_sql);
while($xianshi_row=mysql_fetch_assoc($xianshi_rst)){
 
$admin_dibu_sql="select * from admin_dibu";
$admin_dibu_row=mysql_fetch_assoc(mysql_query($admin_dibu_sql)); 
 
    

?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="../jquery.js"></script>
<style>
*{
    margin: 0px;
    padding:0px;
    font-family: 微软雅黑;
}

a{
    text-decoration: none;
    color: #009999;
}
li{
    list-style: none;
}
#main{
    margin:0 auto;
    width:1280px;
    height: 1800px;
}
#xuanfuchuangkou{
    width:100%;
    height: 80px;
    background:#D8D8D8;
    position: absolute;
    opacity:0.9;
    filter:alpha(opacity=80);

}
.bdsharebuttonbox{
    width: 230px;
    height:80px;
    float: left;
}
.xuanfu_left{
    width:525px;
    height:80px;
    float: left;
}
.xuanfu_right{
    width:445px;
    height:80px;
    float: left;
}
.xuanfu_guanbi{
    width:80px;
    height:80px;
    float: left;
    text-align:center;
}
.top{
    width:1280px;
    height:50px;
    background:#F9F9F9;
    margin:0 auto;
}
.bottom{
    width: 1280px;
    height:1500px;
    
}
.bottom_left{
    width:100px;
    height:1500px;
    float: left;
    background:#F9F9F9;
}
.bottom_center{
    width:1080px;
    height:1500px;
    float: left;
    text-align:center;
    background:#F9F9F9;
}
.center_biaoti{
    width:1080px;
    height:50px;
    
}
.center_wangzhi{
    width:1080px;
    height:50px;
    word-break:break-all;
}
.center_tupian{
    width:1080px;
    height:300px;
    overflow: hidden;

}
.center_neirong{
    width:1080px;
    height:1100px;
    overflow: hidden;
}
.bottom_right{
    width:100px;
    height:1500px;
    float: left;
    background:#F9F9F9;
}
.dibu{
    width:1280px;
    height:250px;
    text-align:center;
    color:#888872;
    clear: both;
    background:#ccc;
}
.dibu ul{
    padding-top:20px;
}
</style>

	<title><?php echo $xianshi_row['biaoti']; ?></title>
</head>
<body>

<div id='xuanfuchuangkou'>
<div class="fenxiang" style="width:1280px;height:80px;margin: 0 auto;">
<div class="xuanfu_left">
<?php
if(isset($_SESSION['username'])){
    echo "<a href='user_index.php' style='font-size: 20px;'>返回首页</a>";
}else{
    echo "<a href='user_index.php' style='font-size: 20px;visibility:hidden;'>返回首页</a>";
}


?>
<span style="margin-left: 280px;font-size: 25px;color:#556980;">一键分享</span>
</div>
<div class="bdsharebuttonbox">
<a href="#" class="bds_more" data-cmd="more"></a>
<a title="分享到QQ空间" href="#" class="bds_qzone" data-cmd="qzone"></a>
<a title="分享到新浪微博" href="#" class="bds_tsina" data-cmd="tsina"></a>
<a title="分享到腾讯微博" href="#" class="bds_tqq" data-cmd="tqq"></a>
<a title="分享到人人网" href="#" class="bds_renren" data-cmd="renren"></a>
<a title="分享到微信" href="#" class="bds_weixin" data-cmd="weixin"></a>
</div>
<div class="xuanfu_right">
</div>
<div class="xuanfu_guanbi">
<span id="xuanfuguanbi" style="font-size: 30px;color:#556980;line-height:80px;cursor: pointer;">X</span>
</div>
</div>
</div>
<div id="main">
<div class="top" style="text-align: right;"><a href="<?php echo $xianshi_row['wangzhi']; ?>"><span id="daojishi" style="color:#009999;font-size:20px;"></span></a></div>
<div class="bottom">
<div class="bottom_left"></div>
<div class="bottom_center">
<div class="center_biaoti"><p style="text-align: center;font-size:25px;"><?php echo $xianshi_row['biaoti']; ?></p></div>
<div class="center_wangzhi">
<p id="p_tiaozhuan" style="text-align: center;line-height:50px;" data_tiaozhuan="<?php echo $xianshi_row['tiaozhuan']; ?>">点击进入主页&rarr;&nbsp;<?php echo "<a id='tiaozhuan' href='{$xianshi_row['wangzhi']}'>{$xianshi_row['wangzhi']}</a>"; echo "&nbsp;&nbsp;&nbsp;"; echo date("Y/m/d",$xianshi_row['time']);?></p>

</div>
<div class="center_tupain"><?php echo "<img src='../image/wenzhangimage/{$xianshi_row['image']}' style='width: 800px;height:500px;display: block;margin:0 auto;' >"; ?> </div>
<div class="center_neirong">
<br>
<?php echo htmlspecialchars_decode(nl2br($xianshi_row['neirong'])); ?>
</div>
</div>
<div class="bottom_right"></div>
</div>
<div class="dibu">
<br>
<?php 
  $replace_dibu=str_replace("@",";",$admin_dibu_row['dibu']);
  echo htmlspecialchars_decode($replace_dibu);

?>
<br>
<p><img src="../image/qq.png"/>&nbsp;<img src="../image/360.jpg"/></p>
</div>
</div>
<?php } ?>
</body>
<script>
i=$("#p_tiaozhuan").attr("data_tiaozhuan");
if(i==0){
    $("#daojishi").text("");
}else{
        
    ting=setInterval(function(){
    i--;
    $("#daojishi").text(i+"秒,点击进入主页");
    if(i<=0){
        clearInterval(ting);
    var tiaozhuan=$("#tiaozhuan").html();
        location=tiaozhuan;
    }

    },1000)
}


$("#xuanfuguanbi").click(function(){
    $("#xuanfuchuangkou").hide(100);
})

$("#xuanfuguanbi").mouseenter(function(){
    $(this).css({"color":"#F7446C"})
})

$("#xuanfuguanbi").mouseleave(function(){
    $(this).css({"color":"#556980"})
})

var xuanfudiv=xuanfuchuangkou.clientHeight;
var keshi=document.documentElement.clientHeight;
var xuanfuobj=keshi-xuanfudiv;
xuanfuchuangkou.style.left=0+"px";
xuanfuchuangkou.style.top=xuanfuobj+"px";

window.onscroll=function(){
   var ua=navigator.userAgent;
   var chromeid=ua.search(/chrome/i);
   if(chromeid>=0){
       var gundong=document.body.scrollTop;
   }else{
       var gundong=document.documentElement.scrollTop;
   }
  xuanfuchuangkou.style.top=gundong+xuanfuobj+"px";
}

window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"32"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到：","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};
with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];

</script>
</html>