Skip to content

Commit

Permalink
Update User.php
Browse files Browse the repository at this point in the history
  • Loading branch information
BSchleyer authored May 21, 2022
1 parent 7e4b87d commit 26ccb14
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/functions/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 26ccb14

Please sign in to comment.