diff options
author | Ermal Luçi <eri@pfsense.org> | 2009-05-13 18:01:51 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2009-05-13 18:01:51 +0000 |
commit | d853e5dbf623528ecd52b9c2ae0f8dadb3952c12 (patch) | |
tree | c6779336e56920a2a6ec867c8014ecb43baea77d /usr/local/www | |
parent | acea2b1236e05ea53f414683e26db47afb902039 (diff) | |
download | pfsense-d853e5dbf623528ecd52b9c2ae0f8dadb3952c12.zip pfsense-d853e5dbf623528ecd52b9c2ae0f8dadb3952c12.tar.gz |
Speedup noticably CP status page. Previously during load it would not show anything and this commit fixes it.
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/status_captiveportal.php | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/usr/local/www/status_captiveportal.php b/usr/local/www/status_captiveportal.php index e83e920..4f6ae86 100755 --- a/usr/local/www/status_captiveportal.php +++ b/usr/local/www/status_captiveportal.php @@ -64,37 +64,27 @@ function clientcmp($a, $b) { } $cpdb = array(); -$cpdblck = lock('captiveportal'); -$fp = @fopen("{$g['vardb_path']}/captiveportal.db","r"); - -if ($fp) { - while (!feof($fp)) { - $line = trim(fgets($fp)); - if ($line) { - $cpent = explode(",", $line); - if ($_GET['showact']) - $cpent[5] = captiveportal_get_last_activity($cpent[1]); - $cpdb[] = $cpent; - } - } - - fclose($fp); - - if ($_GET['order']) { - if ($_GET['order'] == "ip") - $order = 2; - else if ($_GET['order'] == "mac") - $order = 3; - else if ($_GET['order'] == "user") - $order = 4; - else if ($_GET['order'] == "lastact") - $order = 5; - else - $order = 0; - usort($cpdb, "clientcmp"); - } +$cpcontents = `cat /var/db/captiveportal.db`; +$cpcontents = explode("\n", $cpcontents); +foreach ($cpcontents as $cpcontent) { + $cpent = explode(",", $cpcontent); + if ($_GET['showact']) + $cpent[5] = captiveportal_get_last_activity($cpent[1]); + $cpdb[] = $cpent; +} +if ($_GET['order']) { + if ($_GET['order'] == "ip") + $order = 2; + else if ($_GET['order'] == "mac") + $order = 3; + else if ($_GET['order'] == "user") + $order = 4; + else if ($_GET['order'] == "lastact") + $order = 5; + else + $order = 0; + usort($cpdb, "clientcmp"); } -unlock($cpdblck); ?> <table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> |