diff --git a/interface/lib/classes/quota_lib.inc.php b/interface/lib/classes/quota_lib.inc.php
index 55b2aa8571a13fedcca57d07104d3c9064a4649e..74465735350bb7b54369d15e7c2a60d3f70c5a96 100644
--- a/interface/lib/classes/quota_lib.inc.php
+++ b/interface/lib/classes/quota_lib.inc.php
@@ -13,12 +13,14 @@ class quota_lib {
 		}
 		//print_r($monitor_data);
 		
+		// select all websites or websites belonging to client
 		if($clientid != null){
-			$sql_where = " AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=".$clientid.")";
+			$sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost' AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)", $app->functions->intval($client_id));
+		}
+		else {
+			$sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost'");
 		}
 		
-		// select websites belonging to client
-		$sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost'".$sql_where);
 		//print_r($sites);
 		if(is_array($sites) && !empty($sites)){
 			for($i=0;$i<sizeof($sites);$i++){
@@ -111,13 +113,14 @@ class quota_lib {
 		}
 		//print_r($monitor_data);
 		
+		// select all email accounts or email accounts belonging to client
 		if($clientid != null){
-			$sql_where = " AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=".$clientid.")";
+			$emails = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)", $app->functions->intval($client_id));
+		}
+		else {
+			$emails = $app->db->queryAllRecords("SELECT * FROM mail_user");
 		}
 		
-		
-		// select email accounts belonging to client
-		$emails = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE 1".$sql_where);
 		//print_r($emails);
 		if(is_array($emails) && !empty($emails)){
 			for($i=0;$i<sizeof($emails);$i++){
diff --git a/interface/lib/classes/remote.d/mail.inc.php b/interface/lib/classes/remote.d/mail.inc.php
index d97f575ab9545d817ac2aba3e4e85ef65858dff0..e579fb67ff7dec16757f6547bb2b815443c19926 100644
--- a/interface/lib/classes/remote.d/mail.inc.php
+++ b/interface/lib/classes/remote.d/mail.inc.php
@@ -1034,7 +1034,6 @@ class remoting_mail extends remoting {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$client_id = $app->functions->intval($client_id);
 		
 		return $app->quota_lib->get_mailquota_data($client_id, false);
 	}
diff --git a/interface/lib/classes/remote.d/sites.inc.php b/interface/lib/classes/remote.d/sites.inc.php
index 91b4523365a3dae059bcf402a1a4961baf37e4c7..94ec2b14613817efa82943085a91528ebfa27b74 100644
--- a/interface/lib/classes/remote.d/sites.inc.php
+++ b/interface/lib/classes/remote.d/sites.inc.php
@@ -882,7 +882,6 @@ class remoting_sites extends remoting {
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$client_id = $app->functions->intval($client_id);
 	
 		return $app->quota_lib->get_quota_data($client_id, false);
 	}