<?php
require("../class/connect.php");
require("../class/db_sql.php");

$link=db_connect();


//获取信息总数
$result_TotalInfo = mysql_query("select count(*) from phome_ecms_download");
if ($result_TotalInfo)  {
list($getTotalInfo) = mysql_fetch_row($result_TotalInfo);
}
//获取下载总数	
$result_TotalDown = mysql_query("select sum(totaldown) from phome_ecms_download");
if ($result_TotalDown)  {
   list($getTotalDown) = mysql_fetch_row($result_TotalDown);
}
$getTotalDown=$getTotalDown+1024;

//获取总容量大小		
$result_Pfilesize = mysql_query("select sum(Pfilesize) from phome_ecms_download");     
if ($result_Pfilesize )  {
list($getTotalPfilesize) = mysql_fetch_row($result_Pfilesize);}
$getTotalPfilesize=floor($getTotalPfilesize*100)/100;
//获取会员总数
$result_TotalMember = mysql_query("select count(*) from phome_enewsmember");
if ($result_TotalMember)  {
list($getTotalMember) = mysql_fetch_row($result_TotalMember);}
$getTotalMember=$getTotalMember+100;

//获取24小时内更新容量
$endtime=strtotime(date('Y-m-d H:i:s',time())); 

$result_24Pfilesize = mysql_query("select sum(Pfilesize) from phome_ecms_download where '{$endtime}'-newstime <24*60*60");

if ($result_24Pfilesize)  {
list($get24Pfilesize) = mysql_fetch_row($result_24Pfilesize);
}
$get24Pfilesize=$get24Pfilesize+0;

$vipMember=$getTotalInfo;
$vipMemberIncome=$getTotalInfo*0.4;
$agentMemberIncome=($getTotalInfo+$vipMember*1.5)*0.6;
$agentMember=$getTotalInfo+$getTotalInfo*1.5;
	
echo "{";
echo '"TotalInfo":"'.$getTotalInfo.'",';
echo '"TotalPfilesize":"'.$getTotalPfilesize.'",';
echo '"Pfilesize":"'.$get24Pfilesize.'",';
echo '"TotalMember":"'.$getTotalMember.'",';
echo '"TotalDown":"'.$getTotalDown.'",';
echo '"vipMember":"'.$vipMember.'",';
echo '"vipMemberIncome":"'.$vipMemberIncome.'",';
echo '"agentMemberIncome":"'.$agentMemberIncome.'",';
echo '"agentMember":"'.$agentMember.'"';

echo "}"; 

db_close();
?>
