This commit is contained in:
Ermal Lui 2009-06-30 10:37:21 +00:00
parent 3e0621caec
commit 156487ed7d
3 changed files with 4 additions and 2 deletions

View File

@ -40,6 +40,7 @@ require_once("util.inc");
require_once("radius_authentication.inc");
require_once("radius_accounting.inc");
require_once("radius.inc");
require_once("voucher.inc");
$lockfile = "{$g['varrun_path']}/captiveportal.lock";

View File

@ -28,6 +28,7 @@
/* include all configuration functions */
require_once("config.inc");
$dirtyfile = "{$g['varrun_path']}/voucher.dirty";
/*
*Authenticate a voucher and return the remaining time credit in minutes
@ -397,8 +398,8 @@ function voucher_save_db_to_config() {
}
$rollent['active'] = $db;
}
unlock($voucherlck);
unlink($dirtyfile);
unlock($voucherlck);
write_config();
return;
}

View File

@ -53,7 +53,7 @@ foreach($a_roll as $rollent) {
$minutes = $rollent['minutes'];
$active_vouchers = file("{$g['vardb_path']}/voucher_active_$roll.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($active_vouchers as $voucher => $line) {
list($timestamp, $minutes) = explode(",", $line);
list($voucher,$timestamp, $minutes) = explode(",", $line);
$remaining = (($timestamp + 60*$minutes) - time());
if ($remaining > 0) {
$dbent[0] = $voucher;