Kick all users with php command
-
I am trying to write php code to kick all users one by one in a loop, with "dıscconnect" entry in portalauth.log, here is what I have so far, but it is not working.Any help is appreciated
(I am working on pfsense 2.1.2)
require_once("captiveportal.inc");
$allusers = captiveportal_read_db("WHERE sessionid = '{$sessionid}'");
foreach ($allusers as $userid)
captiveportal_disconnect_client($userid);
?>
-
Test this:
require("captiveportal.inc"); if (!is_array($config['captiveportal'])) $config['captiveportal'] = array(); $a_cp =& $config['captiveportal']; foreach ($a_cp as $cpkey => $cp) { $cpzone = $cpkey; if (!empty($cpzone)) { $allusers = captiveportal_read_db("WHERE sessionid <> '0'"); foreach ($allusers as $userid) { if (!empty($userid[5])) // echo "Removing sessionid = ".$userid[5]." "; captiveportal_disconnect_client($userid[5]); } } } ?>
This will stop all users on all interfaces (zones).
I didn't test it myself - to many users on my portal right now ;)