Project

General

Profile

Download (5.62 KB) Statistics
| Branch: | Tag: | Revision:
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
32 6b07c15a Matthew Grooms
##|+PRIV
33
##|*IDENT=page-status-captiveportal
34
##|*NAME=Status: Captive portal page
35
##|*DESCR=Allow access to the 'Status: Captive portal' page.
36
##|*MATCH=status_captiveportal.php*
37
##|-PRIV
38
39 5b237745 Scott Ullrich
require("guiconfig.inc");
40 4df96eff Scott Ullrich
41 6341c556 Scott Ullrich
$pgtitle = array("Status: Captive portal");
42 93641ef8 Scott Ullrich
43 4df96eff Scott Ullrich
include("head.inc");
44
45 5b237745 Scott Ullrich
?>
46
47
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
48 5fd0b016 Scott Ullrich
<script src="/javascript/sorttable.js"></script>
49 5b237745 Scott Ullrich
<?php include("fbegin.inc"); ?>
50
<?php
51
52
if ($_GET['act'] == "del") {
53
	captiveportal_disconnect_client($_GET['id']);
54
}
55
56
flush();
57
58
function clientcmp($a, $b) {
59
	global $order;
60
	return strcmp($a[$order], $b[$order]);
61
}
62
63
$cpdb = array();
64 336e3c1c Charlie
if (file_exists("{$g['vardb_path']}/captiveportal.db"))
65
	$cpcontents = file("{$g['vardb_path']}/captiveportal.db", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
66 93ed7659 Ermal Lu?i
else
67
	$cpcontents = array();
68 336e3c1c Charlie
69
$concurrent = count($cpcontents);
70
71 d853e5db Ermal Lu?i
foreach ($cpcontents as $cpcontent) {
72
	$cpent = explode(",", $cpcontent);
73
	if ($_GET['showact'])
74
		$cpent[5] = captiveportal_get_last_activity($cpent[1]);
75
		$cpdb[] = $cpent;
76
}
77
if ($_GET['order']) {
78
	if ($_GET['order'] == "ip")
79
		$order = 2;
80
	else if ($_GET['order'] == "mac")
81
		$order = 3;
82
	else if ($_GET['order'] == "user")
83
		$order = 4;
84
	else if ($_GET['order'] == "lastact")
85
		$order = 5;
86
	else
87
		$order = 0;
88
	usort($cpdb, "clientcmp");
89 5b237745 Scott Ullrich
}
90
?>
91 336e3c1c Charlie
92
<?php if (isset($config['voucher']['enable'])): ?>
93
<form action="status_captiveportal.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
94
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="tab pane">
95
<tr><td class="tabnavtbl">
96
<?php 
97
	$tab_array = array();
98
        $tab_array[] = array("Logged Users", true, "status_captiveportal.php");
99
        $tab_array[] = array("Active Vouchers", false, "status_captiveportal_vouchers.php");
100
        $tab_array[] = array("Voucher Rolls", false, "status_captiveportal_voucher_rolls.php");
101
        $tab_array[] = array("Test Vouchers", false, "status_captiveportal_test.php");
102
        display_top_tabs($tab_array);
103
?> 
104
</td></tr>
105
<tr>
106
<td class="tabcont">
107
<? endif; ?>
108
109 644905e8 Scott Ullrich
<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0">
110 5b237745 Scott Ullrich
  <tr>
111 644905e8 Scott Ullrich
    <td class="listhdrr"><a href="?order=ip&amp;showact=<?=$_GET['showact'];?>"><?=gettext("IP address");?></a></td>
112
    <td class="listhdrr"><a href="?order=mac&amp;showact=<?=$_GET['showact'];?>"><?=gettext("MAC address");?></a></td>
113
    <td class="listhdrr"><a href="?order=user&amp;showact=<?=$_GET['showact'];?>"><?=gettext("Username");?></a></td>
114 5b237745 Scott Ullrich
	<?php if ($_GET['showact']): ?>
115 644905e8 Scott Ullrich
    <td class="listhdrr"><a href="?order=start&amp;showact=<?=$_GET['showact'];?>"><?=gettext("Session start");?></a></td>
116
    <td class="listhdr"><a href="?order=lastact&amp;showact=<?=$_GET['showact'];?>"><?=gettext("Last activity");?></a></td>
117 5b237745 Scott Ullrich
	<?php else: ?>
118 644905e8 Scott Ullrich
    <td class="listhdr"><a href="?order=start&amp;showact=<?=$_GET['showact'];?>"><?=gettext("Session start");?></a></td>
119 5b237745 Scott Ullrich
	<?php endif; ?>
120 644905e8 Scott Ullrich
    <td class="list sort_ignore"></td>
121 5b237745 Scott Ullrich
  </tr>
122 caec9484 Ermal Lu?i
<?php foreach ($cpdb as $cpent): ?>
123 5b237745 Scott Ullrich
  <tr>
124
    <td class="listlr"><?=$cpent[2];?></td>
125
    <td class="listr"><?=$cpent[3];?>&nbsp;</td>
126 644905e8 Scott Ullrich
    <td class="listr"><?=$cpent[4];?>&nbsp;</td>
127 5b237745 Scott Ullrich
    <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td>
128
	<?php if ($_GET['showact']): ?>
129 644905e8 Scott Ullrich
    <td class="listr"><?php if ($cpent[5]) echo htmlspecialchars(date("m/d/Y H:i:s", $cpent[5]));?></td>
130 5b237745 Scott Ullrich
	<?php endif; ?>
131
	<td valign="middle" class="list" nowrap>
132 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>
133 5b237745 Scott Ullrich
  </tr>
134
<?php endforeach; ?>
135
</table>
136 336e3c1c Charlie
137
<?php if (isset($config['voucher']['enable'])): ?>
138
</td>
139
</tr>
140
</table>
141
</form>
142
<?php endif; ?>
143
144 644905e8 Scott Ullrich
<form action="status_captiveportal.php" method="get" style="margin: 14px;">
145
<input type="hidden" name="order" value="<?=$_GET['order'];?>" />
146 5b237745 Scott Ullrich
<?php if ($_GET['showact']): ?>
147 644905e8 Scott Ullrich
<input type="hidden" name="showact" value="0" />
148
<input type="submit" class="formbtn" value="<?=gettext("Don't show last activity");?>" />
149 5b237745 Scott Ullrich
<?php else: ?>
150 644905e8 Scott Ullrich
<input type="hidden" name="showact" value="1" />
151
<input type="submit" class="formbtn" value="<?=gettext("Show last activity");?>" />
152 5b237745 Scott Ullrich
<?php endif; ?>
153
</form>
154
<?php include("fend.inc"); ?>
155 516fd635 Scott Ullrich
156 5b237745 Scott Ullrich
</body>
157
</html>