[ previous ] [ next ] [ threads ]
 
 From:  "Piotr Makarowicz" <28peter at gmail dot com>
 To:  <m0n0wall at lists dot m0n0 dot ch>
 Subject:  Captive Portal: expiration date and time
 Date:  Thu, 10 Nov 2005 02:47:46 +0100
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.