Hi!
I Have clone od m0n0wall :) : generic-radius2_element_20051110_17-29 (on CD + Floppy)
and I have problem with User manager (Captive portal)
After the end of expire date user is erasing (OK) but this user have still connection to WAN
(internet) !
Does EXPIRATIONDATE realy works ???
Best Regards
Piotr Makarowicz
(I'm still modyfing code, I want change expirationdate to expirationdate and time - any ather ideas?
Carsten:
Your code works! (but user have connection to WAN, (after expirationtime), too..... :(
Thanks for help Carsten Holbach!
---------------------------------------------------------------------------------------------------------------
Letter from Carsten Holbach:
I have had the same idea a few weeks ago.
Maybe you could search the archives for "Captive portal - time based
access", maybe my code helps you.
Greetings
Carsten Holbach
----- Original Message -----
From: Piotr Makarowicz
To: m0n0wall at lists dot m0n0 dot ch
Sent: Thursday, November 10, 2005 2:47 AM
Subject: Captive Portal: expiration date and time
Hi!
I make some changes in Captive Portal,
I want "expirationdate" swap by "expiration date and time" .....
I change index.php (in /usr/local/captiveportal/)
It is part of MY index.php:
//erase expired accounts
if (is_array($userdb)) {
$moddb = false;
for ($i = 0; $i < count($userdb); $i++) {
if ($userdb[$i]['expirationdate'] && (strtotime("-1 min") >
strtotime($userdb[$i]['expirationdate']))) {
// my changes is: -1 min it was: -1 day
unset($userdb[$i]);
$moddb = true;
}
}
if ($moddb)
write_config();
It is part of MY services_captiveportal_users_edit.php:
if ($_POST['expirationdate']){
if(strtotime($_POST['expirationdate']) > 0){
if (strtotime("-1 day") > strtotime(date("m/d/Y H:i",strtotime($_POST['expirationdate'])))){
// my changes is: "m/d/Y H:i" it was: "m/d/Y"
$input_errors[] = "The expiration date lies in the past.";
} else {
//convert from any strtotime compatible date to MM/DD/YYYY
$expdate = strtotime($_POST['expirationdate']);
$_POST['expirationdate'] = date("m/d/Y H:i",$expdate);
}
} else {
$input_errors[] = "Invalid expiration date format; use MM/DD/YYYY instead.";
}
AND it is part of MY services_captiveportal_users.php:
//erase expired accounts
$changed = false;
for ($i = 0; $i < count($a_user); $i++) {
if ($a_user[$i]['expirationdate'] && (strtotime("-1 min") >
strtotime($a_user[$i]['expirationdate']))) {
// my changes is: -1 min it was: -1 day
unset($a_user[$i]);
write_config();
but it works only if I reflesh in webGUI : USERS (CAPTIVE PORTAL) Why ?
Thanks for all reply ;)
Regards
Piotr. |