diff options
author | jim-p <jimp@pfsense.org> | 2011-05-19 08:50:48 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-05-19 08:50:48 -0400 |
commit | 27d0722d13f41c3a569d05588e08dd2b1c18fd43 (patch) | |
tree | 3362f1f378d5d64de1446774fcb0b1b06b81c0b4 /usr/local/bin | |
parent | 62a29fe39e7d579788e97ca05c6266f46fe1f957 (diff) | |
parent | 2f6532d55221f86cbc717350eafb8e4404181cbd (diff) | |
download | pfsense-27d0722d13f41c3a569d05588e08dd2b1c18fd43.zip pfsense-27d0722d13f41c3a569d05588e08dd2b1c18fd43.tar.gz |
Merge remote branch 'upstream/master'
Diffstat (limited to 'usr/local/bin')
-rw-r--r-- | usr/local/bin/captiveportal_gather_stats.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/usr/local/bin/captiveportal_gather_stats.php b/usr/local/bin/captiveportal_gather_stats.php index 5fe1c6b..823b28f 100644 --- a/usr/local/bin/captiveportal_gather_stats.php +++ b/usr/local/bin/captiveportal_gather_stats.php @@ -43,7 +43,7 @@ $concurrent_users = $no_users; $current_user_count = 0; /* tmp file to use to store old data (per interface)*/ -$tmpfile = "{$g['tmp_path']}/captiveportal_online_users"; +$tmpfile = "{$g['vardb_path']}/captiveportal_online_users"; $type = $argv[1]; @@ -82,12 +82,14 @@ if ($type == "loggedin") { $current_user_count = $current_user_count + 1; } - // Write out the latest timestamp - $fd = @fopen($tmpfile, "w"); - if ($fd) { - fwrite($fd, $timestamp); + // Write out the latest timestamp but not if it is empty + if (!empty($timestamp)) { + $fd = @fopen($tmpfile, "w"); + if ($fd) { + fwrite($fd, $timestamp); + } + @fclose($fd); } - @fclose($fd); /* If $timestamp is less than or equal to previous_user_timestamp return 0, * as we only want the 'X' number of users logged in since last RRD poll. |