From 3a929c54188a91859afded6bb1c843301c5aa6d0 Mon Sep 17 00:00:00 2001 From: AGSTR <144728914+agstrxyz@users.noreply.github.com> Date: Fri, 4 Oct 2024 21:16:26 +0700 Subject: [PATCH] Update radius.php *Fix shared user limit --- radius.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/radius.php b/radius.php index 5b646d9b..36aced40 100644 --- a/radius.php +++ b/radius.php @@ -364,6 +364,10 @@ function process_radiust_rest($tur, $code) global $config; $plan = ORM::for_table('tbl_plans')->where('id', $tur['plan_id'])->find_one(); $bw = ORM::for_table("tbl_bandwidth")->find_one($plan['id_bw']); + $USRon = ORM::for_table('radacct')->where('username', $tur['username'])->where_raw("acctstoptime IS NULL")->count(); + if ($USRon >= $plan['shared_users']) { + show_radius_result(["control:Auth-Type" => "Accept", 'Reply-Message' => 'You are already logged in - access denied ('.$USRon.')'], 401); + } if ($bw['rate_down_unit'] == 'Kbps') { $unitdown = 'K'; } else {