diff options
author | Michael Newton <miken32@gmail.com> | 2013-02-14 21:14:38 -0800 |
---|---|---|
committer | Michael Newton <miken32@gmail.com> | 2013-02-14 21:14:38 -0800 |
commit | 91ca7e9fa01bec4e6c9e83674cb109806a67df51 (patch) | |
tree | 42c12f1b96fef68dacd2561e13917140a1023376 /usr | |
parent | 2ccc41c1c537994e10c9deb4ac061ce55edb6537 (diff) | |
download | pfsense-91ca7e9fa01bec4e6c9e83674cb109806a67df51.zip pfsense-91ca7e9fa01bec4e6c9e83674cb109806a67df51.tar.gz |
use associative array for captive portal to prevent confusion, messiness, and abuse
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/bin/captiveportal_gather_stats.php | 4 | ||||
-rwxr-xr-x | usr/local/www/status_captiveportal.php | 12 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/captive_portal_status.widget.php | 16 |
3 files changed, 16 insertions, 16 deletions
diff --git a/usr/local/bin/captiveportal_gather_stats.php b/usr/local/bin/captiveportal_gather_stats.php index 63d91a2..3ff03dd 100644 --- a/usr/local/bin/captiveportal_gather_stats.php +++ b/usr/local/bin/captiveportal_gather_stats.php @@ -77,9 +77,9 @@ if ($type == "loggedin") { @fclose($fd); foreach($cpdb as $user) { - $user_ip = $user[2]; + $user_ip = $user['ip']; // Record the timestamp - $timestamp = $user[0]; + $timestamp = $user['allow_time']; if ($timestamp > $previous_user_timestamp) $current_user_count = $current_user_count + 1; } diff --git a/usr/local/www/status_captiveportal.php b/usr/local/www/status_captiveportal.php index 2e303b6..370420c 100755 --- a/usr/local/www/status_captiveportal.php +++ b/usr/local/www/status_captiveportal.php @@ -156,16 +156,16 @@ if (!empty($cpzone)) { </tr> <?php foreach ($cpdb as $cpent): ?> <tr> - <td class="listlr"><?=$cpent[2];?></td> - <td class="listr"><?=$cpent[3];?> </td> - <td class="listr"><?=$cpent[4];?> </td> - <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td> + <td class="listlr"><?=$cpent['ip'];?></td> + <td class="listr"><?=$cpent['mac'];?> </td> + <td class="listr"><?=$cpent['username'];?> </td> + <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent['allow_time']));?></td> <?php if ($_GET['showact']): - $last_act = captiveportal_get_last_activity($cpent[2]); ?> + $last_act = captiveportal_get_last_activity($cpent['ip']); ?> <td class="listr"><?php if ($last_act != 0) echo htmlspecialchars(date("m/d/Y H:i:s", $last_act));?></td> <?php endif; ?> <td valign="middle" class="list" nowrap> - <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> + <a href="?zone=<?=$cpzone;?>&order=<?=$_GET['order'];?>&showact=<?=htmlspecialchars($_GET['showact']);?>&act=del&id=<?=$cpent['sessionid'];?>" 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> diff --git a/usr/local/www/widgets/widgets/captive_portal_status.widget.php b/usr/local/www/widgets/widgets/captive_portal_status.widget.php index 2db0a2a..48651d7 100644 --- a/usr/local/www/widgets/widgets/captive_portal_status.widget.php +++ b/usr/local/www/widgets/widgets/captive_portal_status.widget.php @@ -65,9 +65,9 @@ $cpdb_all = array(); foreach ($a_cp as $cpzone => $cp) { $cpdb = captiveportal_read_db(); foreach ($cpdb as $cpent) { - $cpent[10] = $cpzone; + $cpent['zone'] = $cpzone; if ($_GET['showact']) - $cpent[11] = captiveportal_get_last_activity($cpent[2]); + $cpent['lastactivity'] = captiveportal_get_last_activity($cpent['ip']); $cpdb_all[] = $cpent; } } @@ -100,15 +100,15 @@ if ($_GET['order']) { </tr> <?php foreach ($cpdb_all as $cpent): ?> <tr> - <td class="listlr"><?=$cpent[2];?></td> - <td class="listr"><?=$cpent[3];?> </td> - <td class="listr"><?=$cpent[4];?> </td> + <td class="listlr"><?=$cpent['ip'];?></td> + <td class="listr"><?=$cpent['mac'];?> </td> + <td class="listr"><?=$cpent['username'];?> </td> <?php if ($_GET['showact']): ?> - <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td> - <td class="listr"><?php if ($cpent[11] && ($cpent[11] > 0)) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[11]));?></td> + <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent['allow_time']));?></td> + <td class="listr"><?php if ($cpent['lastactivity'] && ($cpent['lastactivity'] > 0)) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent['lastactivity']));?></td> <?php endif; ?> <td valign="middle" class="list" nowrap> - <a href="?order=<?=$_GET['order'];?>&showact=<?=$_GET['showact'];?>&act=del&zone=<?=$cpent[10];?>&id=<?=$cpent[5];?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + <a href="?order=<?=$_GET['order'];?>&showact=<?=$_GET['showact'];?>&act=del&zone=<?=$cpent['zone'];?>&id=<?=$cpent['sessionid'];?>" onclick="return confirm('Do you really want to disconnect this client?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> </tr> <?php endforeach; ?> </table> |