only pass binding variable for prepared sql statement if variable exists
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -57,6 +57,12 @@ if (isset($_POST['id'])) {
|
|||||||
if ($page == 'overview') {
|
if ($page == 'overview') {
|
||||||
|
|
||||||
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_index");
|
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_index");
|
||||||
|
$params = [];
|
||||||
|
if ($userinfo['customers_see_all'] == '0') {
|
||||||
|
$params = [
|
||||||
|
'adminid' => $userinfo['adminid']
|
||||||
|
];
|
||||||
|
}
|
||||||
$overview_stmt = Database::prepare("SELECT COUNT(*) AS `number_customers`,
|
$overview_stmt = Database::prepare("SELECT COUNT(*) AS `number_customers`,
|
||||||
SUM(`diskspace_used`) AS `diskspace_used`,
|
SUM(`diskspace_used`) AS `diskspace_used`,
|
||||||
SUM(`mysqls_used`) AS `mysqls_used`,
|
SUM(`mysqls_used`) AS `mysqls_used`,
|
||||||
@@ -68,9 +74,7 @@ if ($page == 'overview') {
|
|||||||
SUM(`subdomains_used`) AS `subdomains_used`,
|
SUM(`subdomains_used`) AS `subdomains_used`,
|
||||||
SUM(`traffic_used`) AS `traffic_used`
|
SUM(`traffic_used`) AS `traffic_used`
|
||||||
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid "));
|
FROM `" . TABLE_PANEL_CUSTOMERS . "`" . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = :adminid "));
|
||||||
$overview = Database::pexecute_first($overview_stmt, array(
|
$overview = Database::pexecute_first($overview_stmt, $params);
|
||||||
'adminid' => $userinfo['adminid']
|
|
||||||
));
|
|
||||||
|
|
||||||
$dec_places = Settings::Get('panel.decimal_places');
|
$dec_places = Settings::Get('panel.decimal_places');
|
||||||
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places);
|
$overview['traffic_used'] = round($overview['traffic_used'] / (1024 * 1024), $dec_places);
|
||||||
@@ -79,9 +83,7 @@ if ($page == 'overview') {
|
|||||||
$number_domains_stmt = Database::prepare("
|
$number_domains_stmt = Database::prepare("
|
||||||
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
|
SELECT COUNT(*) AS `number_domains` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||||
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid"));
|
WHERE `parentdomainid`='0'" . ($userinfo['customers_see_all'] ? '' : " AND `adminid` = :adminid"));
|
||||||
$number_domains = Database::pexecute_first($number_domains_stmt, array(
|
$number_domains = Database::pexecute_first($number_domains_stmt, $params);
|
||||||
'adminid' => $userinfo['adminid']
|
|
||||||
));
|
|
||||||
|
|
||||||
$overview['number_domains'] = $number_domains['number_domains'];
|
$overview['number_domains'] = $number_domains['number_domains'];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user