Ah, Ok.
I think I had the command wrong. It works if i use this: /usr/local/bin/php /usr/local/pkg/kickallusers.php 0
I was originally just calling /usr/local/pkg/kickallusers.php (similar to what squid does in one it's cron jobs).
This now works fine.
For interest, kickallusers.php contains this:
All the echoed HTML could be lost, as there is no need. I wanted to do this to force all clients to disconnect at the same time, and not after xx amount of hours.
echo "Opening Captive Portal Database....................";
require("/etc/inc/captiveportal.inc");
if (file_exists("/var/db/captiveportal.db")) {
$captiveportallck = lock('captiveportaldb');
$cpcontents = file("/var/db/captiveportal.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
unlock($captiveportallck);
}
echo "DONE.";
echo "
";
$cnt = 0;
foreach ($cpcontents as $cpcontent) {
$cpent = explode(",", $cpcontent);
$oursid = $cpent[5];
echo "";
captiveportal_disconnect_client($oursid);
echo "";
$cnt++;
}
$fh = fopen("/usr/local/pkg/kickallusers.log", 'w');
if(flock($fh, LOCK_EX)){
fwrite ($fh, date('l jS \of F Y h:i:s A'));
flock($fh, LOCK_UN);
}
fclose($fh);
if($cnt != 0){
echo "
| Disconnecting [ MAC: $cpent[3] ] | [ IP: $cpent[2] ] | [ ID: $cpent[5] ]..................... | DONE.
|
Completed successfully, $cnt clients disconnected.";
}else{
echo "
There where no clients to disconnect!";
}
exit;
?>
I know the echo's will all buffer out together in this script, they were more just to see the finished output, not a 'rolling report'.
My Captive Portal page has some PHP in it which does a time check, preventing the client from passing through the captive portal between midnight and 7am, the captive portal page that appears says the "Internet Access is currently turned off'. Outside these times, the normal captive portal page appears.
The reason for this kicking script is to kick all clients just after midnight, forcing them to re-visit the captive portal page, which would then show the "Internet Access is currently turned off" page.