1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php
|
2 |
|
|
<?php
|
3 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
4 |
5b237745
|
Scott Ullrich
|
/*
|
5 |
|
|
status_captiveportal.php
|
6 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
7 |
|
|
|
8 |
|
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
9 |
|
|
All rights reserved.
|
10 |
|
|
|
11 |
|
|
Redistribution and use in source and binary forms, with or without
|
12 |
|
|
modification, are permitted provided that the following conditions are met:
|
13 |
|
|
|
14 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
this list of conditions and the following disclaimer.
|
16 |
|
|
|
17 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
notice, this list of conditions and the following disclaimer in the
|
19 |
|
|
documentation and/or other materials provided with the distribution.
|
20 |
|
|
|
21 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
25 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
31 |
|
|
*/
|
32 |
|
|
|
33 |
|
|
require("guiconfig.inc");
|
34 |
4df96eff
|
Scott Ullrich
|
|
35 |
|
|
$pgtitle = "Status: Captive portal";
|
36 |
|
|
include("head.inc");
|
37 |
|
|
|
38 |
5b237745
|
Scott Ullrich
|
?>
|
39 |
|
|
|
40 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
41 |
|
|
<?php include("fbegin.inc"); ?>
|
42 |
74f446e8
|
Bill Marquette
|
<p class="pgtitle"><?=$pgtitle?></p>
|
43 |
5b237745
|
Scott Ullrich
|
<?php
|
44 |
|
|
|
45 |
|
|
if ($_GET['act'] == "del") {
|
46 |
|
|
captiveportal_disconnect_client($_GET['id']);
|
47 |
|
|
}
|
48 |
|
|
|
49 |
|
|
flush();
|
50 |
|
|
|
51 |
|
|
function clientcmp($a, $b) {
|
52 |
|
|
global $order;
|
53 |
|
|
return strcmp($a[$order], $b[$order]);
|
54 |
|
|
}
|
55 |
|
|
|
56 |
|
|
$cpdb = array();
|
57 |
|
|
captiveportal_lock();
|
58 |
|
|
$fp = @fopen("{$g['vardb_path']}/captiveportal.db","r");
|
59 |
|
|
|
60 |
|
|
if ($fp) {
|
61 |
|
|
while (!feof($fp)) {
|
62 |
|
|
$line = trim(fgets($fp));
|
63 |
|
|
if ($line) {
|
64 |
|
|
$cpent = explode(",", $line);
|
65 |
|
|
if ($_GET['showact'])
|
66 |
|
|
$cpent[4] = captiveportal_get_last_activity($cpent[1]);
|
67 |
|
|
$cpdb[] = $cpent;
|
68 |
|
|
}
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
fclose($fp);
|
72 |
|
|
|
73 |
|
|
if ($_GET['order']) {
|
74 |
|
|
if ($_GET['order'] == "ip")
|
75 |
|
|
$order = 2;
|
76 |
|
|
else if ($_GET['order'] == "mac")
|
77 |
|
|
$order = 3;
|
78 |
|
|
else if ($_GET['order'] == "lastact")
|
79 |
|
|
$order = 4;
|
80 |
|
|
else
|
81 |
|
|
$order = 0;
|
82 |
|
|
usort($cpdb, "clientcmp");
|
83 |
|
|
}
|
84 |
|
|
}
|
85 |
|
|
captiveportal_unlock();
|
86 |
|
|
?>
|
87 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
88 |
|
|
<tr>
|
89 |
|
|
<td class="listhdrr"><a href="?order=ip&showact=<?=$_GET['showact'];?>">IP address</a></td>
|
90 |
|
|
<td class="listhdrr"><a href="?order=mac&showact=<?=$_GET['showact'];?>">MAC address</a></td>
|
91 |
|
|
<?php if ($_GET['showact']): ?>
|
92 |
|
|
<td class="listhdrr"><a href="?order=start&showact=<?=$_GET['showact'];?>">Session start</a></td>
|
93 |
|
|
<td class="listhdr"><a href="?order=lastact&showact=<?=$_GET['showact'];?>">Last activity</a></td>
|
94 |
|
|
<?php else: ?>
|
95 |
|
|
<td class="listhdr"><a href="?order=start&showact=<?=$_GET['showact'];?>">Session start</a></td>
|
96 |
|
|
<?php endif; ?>
|
97 |
|
|
<td class="list"></td>
|
98 |
|
|
</tr>
|
99 |
|
|
<?php foreach ($cpdb as $cpent): ?>
|
100 |
|
|
<tr>
|
101 |
|
|
<td class="listlr"><?=$cpent[2];?></td>
|
102 |
|
|
<td class="listr"><?=$cpent[3];?> </td>
|
103 |
|
|
<td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td>
|
104 |
|
|
<?php if ($_GET['showact']): ?>
|
105 |
|
|
<td class="listr"><?php if ($cpent[4]) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[4]));?></td>
|
106 |
|
|
<?php endif; ?>
|
107 |
|
|
<td valign="middle" class="list" nowrap>
|
108 |
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>
|
109 |
5b237745
|
Scott Ullrich
|
</tr>
|
110 |
|
|
<?php endforeach; ?>
|
111 |
|
|
</table>
|
112 |
|
|
<p>
|
113 |
|
|
<form action="status_captiveportal.php" method="GET">
|
114 |
|
|
<input type="hidden" name="order" value="<?=$_GET['order'];?>">
|
115 |
|
|
<?php if ($_GET['showact']): ?>
|
116 |
|
|
<input type="hidden" name="showact" value="0">
|
117 |
|
|
<input type="submit" class="formbtn" value="Don't show last activity">
|
118 |
|
|
<?php else: ?>
|
119 |
|
|
<input type="hidden" name="showact" value="1">
|
120 |
|
|
<input type="submit" class="formbtn" value="Show last activity">
|
121 |
|
|
<?php endif; ?>
|
122 |
|
|
</form>
|
123 |
|
|
</p>
|
124 |
|
|
<?php include("fend.inc"); ?>
|
125 |
516fd635
|
Scott Ullrich
|
|
126 |
|
|
<meta http-equiv="refresh" content="60;url=status_captiveportal.php">
|
127 |
|
|
|
128 |
5b237745
|
Scott Ullrich
|
</body>
|
129 |
|
|
</html>
|