1 |
5b237745
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
status_captiveportal.php
|
5 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
|
|
|
7 |
|
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
8 |
|
|
All rights reserved.
|
9 |
|
|
|
10 |
|
|
Redistribution and use in source and binary forms, with or without
|
11 |
|
|
modification, are permitted provided that the following conditions are met:
|
12 |
|
|
|
13 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
14 |
|
|
this list of conditions and the following disclaimer.
|
15 |
|
|
|
16 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
17 |
|
|
notice, this list of conditions and the following disclaimer in the
|
18 |
|
|
documentation and/or other materials provided with the distribution.
|
19 |
|
|
|
20 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
21 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
22 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
23 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
24 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
25 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
26 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
27 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
29 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
30 |
|
|
*/
|
31 |
1d333258
|
Scott Ullrich
|
/*
|
32 |
|
|
pfSense_MODULE: captiveportal
|
33 |
|
|
*/
|
34 |
5b237745
|
Scott Ullrich
|
|
35 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
36 |
|
|
##|*IDENT=page-status-captiveportal
|
37 |
|
|
##|*NAME=Status: Captive portal page
|
38 |
|
|
##|*DESCR=Allow access to the 'Status: Captive portal' page.
|
39 |
|
|
##|*MATCH=status_captiveportal.php*
|
40 |
|
|
##|-PRIV
|
41 |
|
|
|
42 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
43 |
7ab2b688
|
Scott Ullrich
|
require("functions.inc");
|
44 |
|
|
require("filter.inc");
|
45 |
|
|
require("shaper.inc");
|
46 |
|
|
require("captiveportal.inc");
|
47 |
4df96eff
|
Scott Ullrich
|
|
48 |
d402b77f
|
Scott Ullrich
|
if ($_GET['act'] == "del") {
|
49 |
|
|
captiveportal_disconnect_client($_GET['id']);
|
50 |
3ea73062
|
Scott Ullrich
|
Header("Location: status_captiveportal.php");
|
51 |
d402b77f
|
Scott Ullrich
|
exit;
|
52 |
|
|
}
|
53 |
|
|
|
54 |
6341c556
|
Scott Ullrich
|
$pgtitle = array("Status: Captive portal");
|
55 |
93641ef8
|
Scott Ullrich
|
|
56 |
4df96eff
|
Scott Ullrich
|
include("head.inc");
|
57 |
|
|
|
58 |
5b237745
|
Scott Ullrich
|
?>
|
59 |
|
|
|
60 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
61 |
5fd0b016
|
Scott Ullrich
|
<script src="/javascript/sorttable.js"></script>
|
62 |
5b237745
|
Scott Ullrich
|
<?php include("fbegin.inc"); ?>
|
63 |
|
|
<?php
|
64 |
|
|
|
65 |
|
|
flush();
|
66 |
|
|
|
67 |
|
|
function clientcmp($a, $b) {
|
68 |
|
|
global $order;
|
69 |
|
|
return strcmp($a[$order], $b[$order]);
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
$cpdb = array();
|
73 |
b3890d78
|
Scott Ullrich
|
if (file_exists("{$g['vardb_path']}/captiveportal.db")) {
|
74 |
|
|
$captiveportallck = lock('captiveportal');
|
75 |
|
|
$cpcontents = file("/var/db/captiveportal.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
76 |
|
|
unlock($captiveportallck);
|
77 |
|
|
} else {
|
78 |
93ed7659
|
Ermal Lu?i
|
$cpcontents = array();
|
79 |
b3890d78
|
Scott Ullrich
|
}
|
80 |
336e3c1c
|
Charlie
|
|
81 |
|
|
$concurrent = count($cpcontents);
|
82 |
|
|
|
83 |
d853e5db
|
Ermal Lu?i
|
foreach ($cpcontents as $cpcontent) {
|
84 |
|
|
$cpent = explode(",", $cpcontent);
|
85 |
|
|
if ($_GET['showact'])
|
86 |
f9f71ad3
|
Ermal Lu?i
|
$cpent[5] = captiveportal_get_last_activity($cpent[2]);
|
87 |
d853e5db
|
Ermal Lu?i
|
$cpdb[] = $cpent;
|
88 |
|
|
}
|
89 |
|
|
if ($_GET['order']) {
|
90 |
|
|
if ($_GET['order'] == "ip")
|
91 |
|
|
$order = 2;
|
92 |
|
|
else if ($_GET['order'] == "mac")
|
93 |
|
|
$order = 3;
|
94 |
|
|
else if ($_GET['order'] == "user")
|
95 |
|
|
$order = 4;
|
96 |
|
|
else if ($_GET['order'] == "lastact")
|
97 |
|
|
$order = 5;
|
98 |
|
|
else
|
99 |
|
|
$order = 0;
|
100 |
|
|
usort($cpdb, "clientcmp");
|
101 |
5b237745
|
Scott Ullrich
|
}
|
102 |
|
|
?>
|
103 |
336e3c1c
|
Charlie
|
|
104 |
|
|
<?php if (isset($config['voucher']['enable'])): ?>
|
105 |
|
|
<form action="status_captiveportal.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
|
106 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="tab pane">
|
107 |
|
|
<tr><td class="tabnavtbl">
|
108 |
|
|
<?php
|
109 |
|
|
$tab_array = array();
|
110 |
7540905c
|
Chris Buechler
|
$tab_array[] = array("Active Users", true, "status_captiveportal.php");
|
111 |
336e3c1c
|
Charlie
|
$tab_array[] = array("Active Vouchers", false, "status_captiveportal_vouchers.php");
|
112 |
|
|
$tab_array[] = array("Voucher Rolls", false, "status_captiveportal_voucher_rolls.php");
|
113 |
|
|
$tab_array[] = array("Test Vouchers", false, "status_captiveportal_test.php");
|
114 |
|
|
display_top_tabs($tab_array);
|
115 |
|
|
?>
|
116 |
|
|
</td></tr>
|
117 |
|
|
<tr>
|
118 |
|
|
<td class="tabcont">
|
119 |
|
|
<? endif; ?>
|
120 |
|
|
|
121 |
ff9d6728
|
Scott Ullrich
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
122 |
5b237745
|
Scott Ullrich
|
<tr>
|
123 |
644905e8
|
Scott Ullrich
|
<td class="listhdrr"><a href="?order=ip&showact=<?=$_GET['showact'];?>"><?=gettext("IP address");?></a></td>
|
124 |
|
|
<td class="listhdrr"><a href="?order=mac&showact=<?=$_GET['showact'];?>"><?=gettext("MAC address");?></a></td>
|
125 |
|
|
<td class="listhdrr"><a href="?order=user&showact=<?=$_GET['showact'];?>"><?=gettext("Username");?></a></td>
|
126 |
5b237745
|
Scott Ullrich
|
<?php if ($_GET['showact']): ?>
|
127 |
644905e8
|
Scott Ullrich
|
<td class="listhdrr"><a href="?order=start&showact=<?=$_GET['showact'];?>"><?=gettext("Session start");?></a></td>
|
128 |
|
|
<td class="listhdr"><a href="?order=lastact&showact=<?=$_GET['showact'];?>"><?=gettext("Last activity");?></a></td>
|
129 |
5b237745
|
Scott Ullrich
|
<?php else: ?>
|
130 |
644905e8
|
Scott Ullrich
|
<td class="listhdr"><a href="?order=start&showact=<?=$_GET['showact'];?>"><?=gettext("Session start");?></a></td>
|
131 |
5b237745
|
Scott Ullrich
|
<?php endif; ?>
|
132 |
644905e8
|
Scott Ullrich
|
<td class="list sort_ignore"></td>
|
133 |
5b237745
|
Scott Ullrich
|
</tr>
|
134 |
caec9484
|
Ermal Lu?i
|
<?php foreach ($cpdb as $cpent): ?>
|
135 |
5b237745
|
Scott Ullrich
|
<tr>
|
136 |
|
|
<td class="listlr"><?=$cpent[2];?></td>
|
137 |
|
|
<td class="listr"><?=$cpent[3];?> </td>
|
138 |
644905e8
|
Scott Ullrich
|
<td class="listr"><?=$cpent[4];?> </td>
|
139 |
5b237745
|
Scott Ullrich
|
<td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td>
|
140 |
|
|
<?php if ($_GET['showact']): ?>
|
141 |
644905e8
|
Scott Ullrich
|
<td class="listr"><?php if ($cpent[5]) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[5]));?></td>
|
142 |
5b237745
|
Scott Ullrich
|
<?php endif; ?>
|
143 |
|
|
<td valign="middle" class="list" nowrap>
|
144 |
677c0869
|
Erik Kristensen
|
<a href="?order=<?=$_GET['order'];?>&showact=<?=$_GET['showact'];?>&act=del&id=<?=$cpent[1];?>" 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>
|
145 |
5b237745
|
Scott Ullrich
|
</tr>
|
146 |
|
|
<?php endforeach; ?>
|
147 |
|
|
</table>
|
148 |
336e3c1c
|
Charlie
|
|
149 |
|
|
<?php if (isset($config['voucher']['enable'])): ?>
|
150 |
|
|
</td>
|
151 |
|
|
</tr>
|
152 |
|
|
</table>
|
153 |
|
|
</form>
|
154 |
|
|
<?php endif; ?>
|
155 |
|
|
|
156 |
644905e8
|
Scott Ullrich
|
<form action="status_captiveportal.php" method="get" style="margin: 14px;">
|
157 |
|
|
<input type="hidden" name="order" value="<?=$_GET['order'];?>" />
|
158 |
5b237745
|
Scott Ullrich
|
<?php if ($_GET['showact']): ?>
|
159 |
644905e8
|
Scott Ullrich
|
<input type="hidden" name="showact" value="0" />
|
160 |
|
|
<input type="submit" class="formbtn" value="<?=gettext("Don't show last activity");?>" />
|
161 |
5b237745
|
Scott Ullrich
|
<?php else: ?>
|
162 |
644905e8
|
Scott Ullrich
|
<input type="hidden" name="showact" value="1" />
|
163 |
|
|
<input type="submit" class="formbtn" value="<?=gettext("Show last activity");?>" />
|
164 |
5b237745
|
Scott Ullrich
|
<?php endif; ?>
|
165 |
|
|
</form>
|
166 |
|
|
<?php include("fend.inc"); ?>
|
167 |
516fd635
|
Scott Ullrich
|
|
168 |
5b237745
|
Scott Ullrich
|
</body>
|
169 |
|
|
</html>
|