Update customer_traffic.php
This commit is contained in:
@@ -23,20 +23,19 @@ define('AREA', 'customer');
|
|||||||
* Include our init.php, which manages Sessions, Language etc.
|
* Include our init.php, which manages Sessions, Language etc.
|
||||||
*/
|
*/
|
||||||
$intrafficpage = 1;
|
$intrafficpage = 1;
|
||||||
require ("./lib/init.php");
|
require('./lib/init.php');
|
||||||
$traffic = '';
|
$traffic = '';
|
||||||
$month = null;
|
$month = null;
|
||||||
$year = null;
|
$year = null;
|
||||||
|
|
||||||
if (isset($_POST['month'])
|
if (isset($_POST['month'])
|
||||||
&& isset($_POST['year']))
|
&& isset($_POST['year'])
|
||||||
{
|
) {
|
||||||
$month = intval($_POST['month']);
|
$month = intval($_POST['month']);
|
||||||
$year = intval($_POST['year']);
|
$year = intval($_POST['year']);
|
||||||
}
|
} elseif (isset($_GET['month'])
|
||||||
elseif(isset($_GET['month'])
|
&& isset($_GET['year'])
|
||||||
&& isset($_GET['year']))
|
) {
|
||||||
{
|
|
||||||
$month = intval($_GET['month']);
|
$month = intval($_GET['month']);
|
||||||
$year = intval($_GET['year']);
|
$year = intval($_GET['year']);
|
||||||
}
|
}
|
||||||
@@ -44,22 +43,16 @@ elseif(isset($_GET['month'])
|
|||||||
//BAM! $_GET???
|
//BAM! $_GET???
|
||||||
|
|
||||||
elseif (isset($_GET['page'])
|
elseif (isset($_GET['page'])
|
||||||
&& $_GET['page'] == "current")
|
&& $_GET['page'] == 'current'
|
||||||
{
|
) {
|
||||||
if(date('d') != '01')
|
if (date('d') != '01') {
|
||||||
{
|
|
||||||
$month = date('m');
|
$month = date('m');
|
||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
}
|
} else {
|
||||||
else
|
if (date('m') == '01') {
|
||||||
{
|
|
||||||
if(date('m') == '01')
|
|
||||||
{
|
|
||||||
$month = 12;
|
$month = 12;
|
||||||
$year = date('Y') - 1;
|
$year = date('Y') - 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$month = date('m') - 1;
|
$month = date('m') - 1;
|
||||||
$year = date('Y');
|
$year = date('Y');
|
||||||
}
|
}
|
||||||
@@ -67,8 +60,7 @@ elseif (isset($_GET['page'])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($month)
|
if (!is_null($month)
|
||||||
&& !is_null($year))
|
&& !is_null($year)) {
|
||||||
{
|
|
||||||
$traf['byte'] = 0;
|
$traf['byte'] = 0;
|
||||||
$result = $db->query("SELECT
|
$result = $db->query("SELECT
|
||||||
SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail',
|
SUM(`http`) as 'http', SUM(`ftp_up`) AS 'ftp_up', SUM(`ftp_down`) as 'ftp_down', SUM(`mail`) as 'mail',
|
||||||
@@ -82,8 +74,7 @@ if(!is_null($month)
|
|||||||
$traffic_complete['mail'] = 0;
|
$traffic_complete['mail'] = 0;
|
||||||
$show = '';
|
$show = '';
|
||||||
|
|
||||||
while($row = $db->fetch_array($result))
|
while ($row = $db->fetch_array($result)) {
|
||||||
{
|
|
||||||
$http = $row['http'];
|
$http = $row['http'];
|
||||||
$ftp = $row['ftp_up'] + $row['ftp_down'];
|
$ftp = $row['ftp_up'] + $row['ftp_down'];
|
||||||
$mail = $row['mail'];
|
$mail = $row['mail'];
|
||||||
@@ -91,10 +82,9 @@ if(!is_null($month)
|
|||||||
$traffic_complete['http'] += $http;
|
$traffic_complete['http'] += $http;
|
||||||
$traffic_complete['ftp'] += $ftp;
|
$traffic_complete['ftp'] += $ftp;
|
||||||
$traffic_complete['mail'] += $mail;
|
$traffic_complete['mail'] += $mail;
|
||||||
$traf['day'] = $row['day'] . ".";
|
$traf['day'] = $row['day'] . '.';
|
||||||
|
|
||||||
if(extension_loaded('bcmath'))
|
if (extension_loaded('bcmath')) {
|
||||||
{
|
|
||||||
$traf['ftptext'] = bcdiv($row['ftp_up'], 1024, $settings['panel']['decimal_places']) . " MB up/ " . bcdiv($row['ftp_down'], 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
|
$traf['ftptext'] = bcdiv($row['ftp_up'], 1024, $settings['panel']['decimal_places']) . " MB up/ " . bcdiv($row['ftp_down'], 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
|
||||||
$traf['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
$traf['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
||||||
$traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
$traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
||||||
@@ -102,9 +92,7 @@ if(!is_null($month)
|
|||||||
$traf['http'] = bcdiv($http, 1024, $settings['panel']['decimal_places']);
|
$traf['http'] = bcdiv($http, 1024, $settings['panel']['decimal_places']);
|
||||||
$traf['mail'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']);
|
$traf['mail'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']);
|
||||||
$traf['byte'] = bcdiv($traf['byte'], 1024, $settings['panel']['decimal_places']);
|
$traf['byte'] = bcdiv($traf['byte'], 1024, $settings['panel']['decimal_places']);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$traf['ftptext'] = round($row['ftp_up'] / 1024, $settings['panel']['decimal_places']) . " MB up/ " . round($row['ftp_down'] / 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
|
$traf['ftptext'] = round($row['ftp_up'] / 1024, $settings['panel']['decimal_places']) . " MB up/ " . round($row['ftp_down'] / 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
|
||||||
$traf['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
$traf['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
||||||
$traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
$traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
||||||
@@ -114,28 +102,22 @@ if(!is_null($month)
|
|||||||
$traf['byte'] = round($traf['byte'] / 1024, $settings['panel']['decimal_places']);
|
$traf['byte'] = round($traf['byte'] / 1024, $settings['panel']['decimal_places']);
|
||||||
}
|
}
|
||||||
|
|
||||||
eval("\$traffic.=\"" . getTemplate("traffic/traffic_month") . "\";");
|
eval("\$traffic.=\"" . getTemplate('traffic/traffic_month') . "\";");
|
||||||
$show = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
|
$show = $lng['traffic']['months'][intval($row['month'])] . ' ' . $row['year'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(extension_loaded('bcmath'))
|
if (extension_loaded('bcmath')) {
|
||||||
{
|
|
||||||
$traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024, $settings['panel']['decimal_places']);
|
$traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024, $settings['panel']['decimal_places']);
|
||||||
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024, $settings['panel']['decimal_places']);
|
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024, $settings['panel']['decimal_places']);
|
||||||
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024, $settings['panel']['decimal_places']);
|
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024, $settings['panel']['decimal_places']);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$traffic_complete['http'] = round($traffic_complete['http'] / 1024, $settings['panel']['decimal_places']);
|
$traffic_complete['http'] = round($traffic_complete['http'] / 1024, $settings['panel']['decimal_places']);
|
||||||
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024, $settings['panel']['decimal_places']);
|
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / 1024, $settings['panel']['decimal_places']);
|
||||||
$traffic_complete['mail'] = round($traffic_complete['mail'] / 1024, $settings['panel']['decimal_places']);
|
$traffic_complete['mail'] = round($traffic_complete['mail'] / 1024, $settings['panel']['decimal_places']);
|
||||||
}
|
}
|
||||||
|
|
||||||
eval("echo \"" . getTemplate("traffic/traffic_details") . "\";");
|
eval("echo \"" . getTemplate('traffic/traffic_details') . "\";");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
$result = $db->query("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
|
$result = $db->query("SELECT `month`, `year`, SUM(`http`) AS http, SUM(`ftp_up`) AS ftp_up, SUM(`ftp_down`) AS ftp_down, SUM(`mail`) AS mail
|
||||||
FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid` = '" . $userinfo['customerid'] . "'
|
FROM `" . TABLE_PANEL_TRAFFIC . "` WHERE `customerid` = '" . $userinfo['customerid'] . "'
|
||||||
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
|
GROUP BY CONCAT(`year`,`month`) ORDER BY CONCAT(`year`,`month`) DESC LIMIT 12");
|
||||||
@@ -143,8 +125,7 @@ else
|
|||||||
$traffic_complete['ftp'] = 0;
|
$traffic_complete['ftp'] = 0;
|
||||||
$traffic_complete['mail'] = 0;
|
$traffic_complete['mail'] = 0;
|
||||||
|
|
||||||
while($row = $db->fetch_array($result))
|
while ($row = $db->fetch_array($result)) {
|
||||||
{
|
|
||||||
$http = $row['http'];
|
$http = $row['http'];
|
||||||
$ftp_up = $row['ftp_up'];
|
$ftp_up = $row['ftp_up'];
|
||||||
$ftp_down = $row['ftp_down'];
|
$ftp_down = $row['ftp_down'];
|
||||||
@@ -157,8 +138,7 @@ else
|
|||||||
$traf['monthname'] = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
|
$traf['monthname'] = $lng['traffic']['months'][intval($row['month'])] . " " . $row['year'];
|
||||||
$traf['byte'] = $http + $ftp_up + $ftp_down + $mail;
|
$traf['byte'] = $http + $ftp_up + $ftp_down + $mail;
|
||||||
|
|
||||||
if(extension_loaded('bcmath'))
|
if (extension_loaded('bcmath')) {
|
||||||
{
|
|
||||||
$traf['ftptext'] = bcdiv($ftp_up, 1024, $settings['panel']['decimal_places']) . " MB up/ " . bcdiv($ftp_down, 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
|
$traf['ftptext'] = bcdiv($ftp_up, 1024, $settings['panel']['decimal_places']) . " MB up/ " . bcdiv($ftp_down, 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
|
||||||
$traf['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
$traf['httptext'] = bcdiv($http, 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
||||||
$traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
$traf['mailtext'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
||||||
@@ -166,9 +146,7 @@ else
|
|||||||
$traf['http'] = bcdiv($http, 1024, $settings['panel']['decimal_places']);
|
$traf['http'] = bcdiv($http, 1024, $settings['panel']['decimal_places']);
|
||||||
$traf['mail'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']);
|
$traf['mail'] = bcdiv($mail, 1024, $settings['panel']['decimal_places']);
|
||||||
$traf['byte'] = bcdiv($traf['byte'], 1024 * 1024, $settings['panel']['decimal_places']);
|
$traf['byte'] = bcdiv($traf['byte'], 1024 * 1024, $settings['panel']['decimal_places']);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$traf['ftptext'] = round($ftp_up / 1024, $settings['panel']['decimal_places']) . " MB up/ " . round($ftp_down / 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
|
$traf['ftptext'] = round($ftp_up / 1024, $settings['panel']['decimal_places']) . " MB up/ " . round($ftp_down / 1024, $settings['panel']['decimal_places']) . " MB down (FTP)";
|
||||||
$traf['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
$traf['httptext'] = round($http / 1024, $settings['panel']['decimal_places']) . " MB (HTTP)";
|
||||||
$traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
$traf['mailtext'] = round($mail / 1024, $settings['panel']['decimal_places']) . " MB (Mail)";
|
||||||
@@ -178,23 +156,18 @@ else
|
|||||||
$traf['byte'] = round($traf['byte'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
$traf['byte'] = round($traf['byte'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||||
}
|
}
|
||||||
|
|
||||||
eval("\$traffic.=\"" . getTemplate("traffic/traffic_traffic") . "\";");
|
eval("\$traffic.=\"" . getTemplate('traffic/traffic_traffic') . "\";");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(extension_loaded('bcmath'))
|
if (extension_loaded('bcmath')) {
|
||||||
{
|
|
||||||
$traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024 * 1024, $settings['panel']['decimal_places']);
|
$traffic_complete['http'] = bcdiv($traffic_complete['http'], 1024 * 1024, $settings['panel']['decimal_places']);
|
||||||
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024 * 1024, $settings['panel']['decimal_places']);
|
$traffic_complete['ftp'] = bcdiv($traffic_complete['ftp'], 1024 * 1024, $settings['panel']['decimal_places']);
|
||||||
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024 * 1024, $settings['panel']['decimal_places']);
|
$traffic_complete['mail'] = bcdiv($traffic_complete['mail'], 1024 * 1024, $settings['panel']['decimal_places']);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$traffic_complete['http'] = round($traffic_complete['http'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
$traffic_complete['http'] = round($traffic_complete['http'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||||
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
$traffic_complete['ftp'] = round($traffic_complete['ftp'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||||
$traffic_complete['mail'] = round($traffic_complete['mail'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
$traffic_complete['mail'] = round($traffic_complete['mail'] / (1024 * 1024), $settings['panel']['decimal_places']);
|
||||||
}
|
}
|
||||||
|
|
||||||
eval("echo \"" . getTemplate("traffic/traffic") . "\";");
|
eval("echo \"" . getTemplate('traffic/traffic') . "\";");
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user