summaryrefslogtreecommitdiffstats
path: root/usr/local/www/status_captiveportal.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2012-12-18 09:19:34 +0000
committerErmal <eri@pfsense.org>2012-12-18 09:20:22 +0000
commit26ee5aafa2787c9249b50a57a7ab9977e6303fe8 (patch)
treee3e3b0a40271588a9bee5cd4ff17632167bb2030 /usr/local/www/status_captiveportal.php
parenta56c90a2f66368b6e9f1ade3072e7b457ed245a1 (diff)
downloadpfsense-26ee5aafa2787c9249b50a57a7ab9977e6303fe8.zip
pfsense-26ee5aafa2787c9249b50a57a7ab9977e6303fe8.tar.gz
Convert the CP db to sqlite rather than a text file. Some more optimizations might be needed and probably vouchers db might need conversion as well.
Diffstat (limited to 'usr/local/www/status_captiveportal.php')
-rwxr-xr-xusr/local/www/status_captiveportal.php21
1 files changed, 6 insertions, 15 deletions
diff --git a/usr/local/www/status_captiveportal.php b/usr/local/www/status_captiveportal.php
index 0963a61..ed61e86 100755
--- a/usr/local/www/status_captiveportal.php
+++ b/usr/local/www/status_captiveportal.php
@@ -78,22 +78,13 @@ function clientcmp($a, $b) {
}
if (!empty($cpzone)) {
- $cpdb = array();
- if (file_exists("{$g['vardb_path']}/captiveportal_{$cpzone}.db")) {
- $captiveportallck = lock("captiveportaldb{$cpzone}");
- $cpcontents = file("/var/db/captiveportal_{$cpzone}.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
- unlock($captiveportallck);
- } else
- $cpcontents = array();
-
- $concurrent = count($cpcontents);
-
- foreach ($cpcontents as $cpcontent) {
- $cpent = explode(",", $cpcontent);
+ $cpdb = captiveportal_read_db();
+ $concurrent = count($cpdb);
+
+ foreach ($cpdb as $cpent) {
$sessionid = $cpent[5];
if ($_GET['showact'])
$cpent[5] = captiveportal_get_last_activity($cpent[2]);
- $cpdb[$sessionid] = $cpent;
}
if ($_GET['order']) {
if ($_GET['order'] == "ip")
@@ -168,7 +159,7 @@ if (!empty($cpzone)) {
<?php endif; ?>
<td class="list sort_ignore"></td>
</tr>
-<?php foreach ($cpdb as $sid => $cpent): ?>
+<?php foreach ($cpdb as $cpent): ?>
<tr>
<td class="listlr"><?=$cpent[2];?></td>
<td class="listr"><?=$cpent[3];?>&nbsp;</td>
@@ -178,7 +169,7 @@ if (!empty($cpzone)) {
<td class="listr"><?php if ($cpent[5]) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[5]));?></td>
<?php endif; ?>
<td valign="middle" class="list" nowrap>
- <a href="?zone=<?=$cpzone;?>&order=<?=$_GET['order'];?>&showact=<?=htmlspecialchars($_GET['showact']);?>&act=del&id=<?=$sid;?>" onclick="return confirm('<?=gettext("Do you really want to disconnect this client?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("Disconnect");?>"></a></td>
+ <a href="?zone=<?=$cpzone;?>&order=<?=$_GET['order'];?>&showact=<?=htmlspecialchars($_GET['showact']);?>&act=del&id=<?=$cpent[5];?>" onclick="return confirm('<?=gettext("Do you really want to disconnect this client?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" title="<?=gettext("Disconnect");?>"></a></td>
</tr>
<?php endforeach; endif; ?>
</table>
OpenPOWER on IntegriCloud