Merge pull request #129 from gerandonk/Development

Fix loop disconnect to all Nas
This commit is contained in:
iBNu Maksum 2024-03-16 20:24:25 +07:00 committed by GitHub
commit 23790d3258
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -301,7 +301,11 @@ class Radius
if ($_app_stage == 'demo') {
return null;
}
$nas = Radius::getTableNas()->findMany();
/**
* Fix loop to all Nas but still detecting Hotspot Multylogin from other Nas
*/
$act = ORM::for_table('radacct')->where_raw("acctstoptime IS NULL")->where('username', $username)->find_one();
$nas = Radius::getTableNas()->where('nasname', $act['nasipaddress'])->find_many();
$count = count($nas) * 15;
set_time_limit($count);
$result = [];
@ -310,7 +314,7 @@ class Radius
if (!empty($n['ports'])) {
$port = $n['ports'];
}
$result[] = $n['nasname'] . ': ' . @shell_exec("echo 'User-Name = $username' | " . Radius::getClient() . " " . trim($n['nasname']) . ":$port disconnect '" . $n['secret'] . "'");
$result[] = $n['nasname'] . ': ' . @shell_exec("echo 'User-Name = $username,Framed-IP-Address = " . $act['framedipaddress'] . "' | radclient -x " . trim($n['nasname']) . ":$port disconnect '" . $n['secret'] . "'");
}
return $result;
}