From 26ccb145a33e2c6ea95cb4a2bad3704b9373ef56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Schleyer?= Date: Sat, 21 May 2022 14:10:31 +0200 Subject: [PATCH] Update User.php --- app/functions/User.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/functions/User.php b/app/functions/User.php index a7f4855..a79da5c 100755 --- a/app/functions/User.php +++ b/app/functions/User.php @@ -258,6 +258,25 @@ public function serviceCount($user_id) return $count; } + + public function activeCount($user_id) + { + $count = 0; + + $SQL = self::db()->prepare("SELECT * FROM `teamspeaks` WHERE `user_id` = :user_id AND `deleted_at` IS NULL AND `state` = 'ACTIVE'"); + $SQL->execute(array(":user_id" => $user_id)); + $count = $count + $SQL->rowCount(); + + $SQL = self::db()->prepare("SELECT * FROM `vm_servers` WHERE `user_id` = :user_id AND `deleted_at` IS NULL' AND `state` = 'active'"); + $SQL->execute(array(":user_id" => $user_id)); + $count = $count + $SQL->rowCount(); + + $SQL = self::db()->prepare("SELECT * FROM `webspace` WHERE `user_id` = :user_id AND `deleted_at` IS NULL AND `state` = 'active'"); + $SQL->execute(array(":user_id" => $user_id)); + $count = $count + $SQL->rowCount(); + + return $count; + } public function teamspeakCount($user_id) {