From 46bc6e545a17e77202aaf01ec0cd8d5a46567525 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 25 Aug 2015 08:08:24 -0300 Subject: Move main pfSense content to src/ --- src/usr/local/bin/captiveportal_gather_stats.php | 115 +++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 src/usr/local/bin/captiveportal_gather_stats.php (limited to 'src/usr/local/bin/captiveportal_gather_stats.php') diff --git a/src/usr/local/bin/captiveportal_gather_stats.php b/src/usr/local/bin/captiveportal_gather_stats.php new file mode 100644 index 0000000..23d6b5d --- /dev/null +++ b/src/usr/local/bin/captiveportal_gather_stats.php @@ -0,0 +1,115 @@ +#!/usr/local/bin/php-cgi -q + $previous_user_timestamp) { + $current_user_count = $current_user_count + 1; + } + } + + // 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); + } + + /* 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. + */ + if ($timestamp <= $previous_user_timestamp) { + $result = 0; + } else { + $result = $current_user_count; + } +} elseif ($type == "concurrent") { + $result = $no_users; +} + +echo "$result"; + +?> -- cgit v1.1