<?php

error_reporting(0); 
session_start();

include("../../conn.php");
include("../../common.php");
if(!isset($_SESSION['username'])){
	echo "<script>alert('管理身份已失效请重新登录!')</script><script>top.location.href='../index.php'</script>";
	exit;
	}

$username2=ubo($_SESSION['username']);
$sql1 = mysql_query("SELECT * FROM zhucema WHERE  user='$username2'");
$row=mysql_fetch_array($sql1);
if($row[zdsl]!="1"){echo "<script>location.href='../index.php'</script>";}
$type="WHERE name='$username'";
$duqu=queryall(admin,$type);
$day=date("Y-m-d");
$zuori=date("Y-m-d",strtotime("$day-1 day"));
$date=date("Y-m-d",strtotime("$day-2 day"));
$date2=date("Y-m-d",strtotime("$day-3 day"));
$date3=date("Y-m-d",strtotime("$day-4 day"));
$date4=date("Y-m-d",strtotime("$day-5 day"));
$date5=date("Y-m-d",strtotime("$day-6 day"));
$shijianday="'".$date5."'".","."'".$date4."'".","."'".$date3."'".","."'".$date2."'".","."'".$date."'".","."'".$zuori."'".","."'".$day."'";
$arr = array("1"=>$day,"2"=>$zuori,"3"=>$date,"4"=>$date2,"5"=>$date3,"6"=>$date4,"7"=>$date5);
foreach($jj as $i=>$value){
$sj = 'sj';
$sj .= $i;
$$sj = "0";
$sql = "WHERE 1=1 ";
$sql .="   and bindtime  like '%".$jj[$i]."%'";
$sqlc="select sum(cs) from user   ".$sql." ";
if ($resh=mysql_query($sqlc)){
list($$sj)=mysql_fetch_row($resh);
$$sj = empty($$sj) ? "0" : $$sj;
mysql_free_result($resh);
} 
}
if($_POST[ubosubmit]){
$username="ccc='ok'  where id='1'";
upalldt(ubobq,$username);
$nn=base64_decode('5Y+R6KqT5oiQ5Yqf77yM5q2k6KqT6KiA5LiA57uP5Y+R6KqT77yM56uL5Y2z55Sf5pWI77yB');
$nn2=iconv("UTF-8","GB2312",$nn);
echo "<script>alert('".$nn2."')</script>";
}
$username="where id='1'";
$ubobq=queryall(ubobq,$username);
$dashang="'".$sj7."'".","."'".$sj6."'".","."'".$sj5."'".","."'".$sj4."'".","."'".$sj3."'".","."'".$sj2."'".","."'".$sj1."'";
$jj = array("1"=>$day,"2"=>$zuori,"3"=>$date,"4"=>$date2,"5"=>$date3,"6"=>$date4,"7"=>$date5);
foreach($jj as $i=>$value){
$sj = 'sj';
$sj .= $i;
$$sj = "0";
$sql = "WHERE 1=1 ";
$sql .=" and bindtime  like '%".$jj[$i]."%' and (recommend in (select ma from zhucema WHERE zd ='".$username2."' ) or recommend='".$username2."')";
$sqlc = mysql_query("SELECT * FROM user ".$sql."  ");
$$sj = mysql_num_rows($sqlc);
$$sj = empty($$sj) ? "0" : $$sj;
}
$shipinday="'".$sj7."'".","."'".$sj6."'".","."'".$sj5."'".","."'".$sj4."'".","."'".$sj3."'".","."'".$sj2."'".","."'".$sj1."'";
$jj = array("1"=>$day,"2"=>$zuori,"3"=>$date,"4"=>$date2,"5"=>$date3,"6"=>$date4,"7"=>$date5);
foreach($jj as $i=>$value){
$sj = 'sj';
$sj .= $i;
$$sj = "0";
$sql = "WHERE 1=1";
$sql .="   and ordeid  like '%".$jj[$i]."%'";
$sqlc = mysql_query("SELECT * FROM chongzhi ".$sql." ");
$$sj = mysql_num_rows($sqlc);
$$sj = empty($$sj) ? "0" : $$sj;
}
$userday="'".$sj7."'".","."'".$sj6."'".","."'".$sj5."'".","."'".$sj4."'".","."'".$sj3."'".","."'".$sj2."'".","."'".$sj1."'";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>控制面板</title>
<link rel="stylesheet" type="text/css" href="newui/layui.css" />
<script type="text/javascript" src="newui/layui/layui.js"></script>
</head>
<body class="layui-anim layui-anim-upbit" style="background-color: #F2F2F2;">
<div style="border-bottom: 1px solid #009688; padding: 2px 0px 0px 1px;margin-bottom: 10px;">
<p class="layui-btn"><i class="layui-icon">&#xF015;</i> 后台首页</p>
</div>
<blockquote ></blockquote>
<div class="layui-fluid">
<div class="layui-row layui-col-space10">
<div class="layui-col-md6">
<script type="text/javascript" src="newui/js/echarts.common.min.js"></script>
<div style=" background-color: #FFF;">
<div id="main" style="width: 100%;height:264px;"></div>
</div>
<script lang="javascript" type="text/javascript">
var myChart = echarts.init(document.getElementById('main'));
option = {
title: {
text: '动态数据'
},
tooltip : {
trigger: 'axis',
axisPointer : {
type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
}
},
legend: {
data:['注册量']
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis : [
{			
type : 'category',
data : [<?php echo $shijianday?>]
}
],
yAxis : [
{
type : 'value'
}
],
series : [

{
name:'注册量',
color: ['#1ABC9C'],
type:'bar',
data:[<?php echo $shipinday?>],
},

]
};
myChart.setOption(option);
</script>         
</div>
<div class="layui-col-md6">	
<div class="layui-row layui-col-space10">
<div class="layui-col-md6" style="text-align: center;">
<div style="background-color: #FFF; height: 80px;border-radius:5px;padding: 1px 1px;">
<div class="layui-col-md5 layui-bg-green"><i class="layui-icon" style="font-size: 40px;line-height: 80px; color: #FFF;">&#xF007;</i></div>
<div class="layui-col-md7"> 
<?php
$sql = mysql_query("SELECT count(1) FROM user WHERE recommend in (select ma from zhucema WHERE zd ='".$username2."' ) or recommend='".$username2."'");
$bs = mysql_fetch_array($sql)[0];
?>
<h1 style="font-size: 24px; margin-top: 16px;"> <?php if($bs==null){?>0<?php }else{?><?php echo $bs?><?php }?> 个</h1>玩家数量</div>
</div>
</div>
<div class="layui-col-md6" style="text-align: center;">
<div style="background-color: #FFF; height: 80px;border-radius:5px;padding: 1px 1px;">
<div class="layui-col-md5 layui-bg-green"><i class="layui-icon" style="font-size: 40px;line-height: 80px; color: #FFF;">&#xF007;</i></div>
<div class="layui-col-md7"> 
<?php
$sql = mysql_query("SELECT count(1) FROM chongzhi WHERE recommend in (select ma from zhucema WHERE zd ='".$username2."' ) or recommend='".$username2."'");
$bs1 = mysql_fetch_array($sql)[0];
$sql = mysql_query("SELECT count(1) FROM chongzhi WHERE status='发放成功' and (recommend in (select ma from zhucema WHERE zd ='".$username2."' ) or recommend='".$username2."')");
$bs3 = mysql_fetch_array($sql)[0];
?>
<h1 style="font-size: 24px; margin-top: 16px;"> <?php if($bs1==null){?>0<?php }else{?><?php echo $bs1?><?php }?> 单</h1>订单数量</div>
</div>
</div>
<div class=" layui-col-md6" style="text-align: center;">
<div style="background-color: #FFF; height: 80px;border-radius:5px;padding: 1px 1px;">
<div class="layui-col-md5 layui-bg-green"><i class="layui-icon" style="font-size: 40px;line-height: 80px; color: #FFF;">&#xF007;</i></div>
<div class="layui-col-md7">
<?php
$sql = mysql_query("SELECT count(1) FROM zhucema WHERE zd ='".$username2."' ");
$bs2 = mysql_fetch_array($sql)[0];
?> 
<h1 style="font-size: 24px; margin-top: 16px;"><?php if($bs2==null){?>0<?php }else{?><?php echo $bs2?><?php }?> 个</h1>代理列表</div>
</div>
</div>
<div class=" layui-col-md6" style="text-align: center;">
<div style="background-color: #FFF; height: 80px;border-radius:5px;padding: 1px 1px;">
<div class="layui-col-md5 " style="background-color:#E066FF;"><i class="layui-icon" style="font-size: 40px;line-height: 80px; color: #FFF;">&#xF157;</i> </div>
<div class="layui-col-md7">
<h1 style="font-size: 24px; margin-top: 16px;"><?php if($bs1==null){?>0<?php }else{?><?php echo $bs3?><?php }?> 单</h1>成功订单</div>
</div>
</div>
<div class=" layui-col-md6" style="text-align: center;">
<div style="background-color: #FFF; height: 80px;border-radius:5px;padding: 1px 1px;">
<div class="layui-col-md5 " style="background-color:#E066FF;"><i class="layui-icon" style="font-size: 40px;line-height: 80px; color: #FFF;">&#xF157;</i> </div>
<div class="layui-col-md7"> 
<h1 style="font-size: 24px; margin-top: 16px;">招财</h1>冲冲冲</div>
</div>
</div>
<div class=" layui-col-md6" style="text-align: center;">
<div style="background-color: #FFF; height: 80px;border-radius:5px;padding: 1px 1px;">
<div class="layui-col-md5 " style="background-color:#E066FF;"><i class="layui-icon" style="font-size: 40px;line-height: 80px; color: #FFF;">&#xF157;</i> </div>
<div class="layui-col-md7"> 
<h1 style="font-size: 24px; margin-top: 16px;"> QQ</h1></div>
</div>
</div>
</div>
</div>        
</div> 
</div>  
</div>  
</body>
</html>
<?php include_once('footer.php');?>