Project

General

Profile

Download (7.2 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php 
2
/* $Id$ */
3
/*
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
	pfSense_MODULE:	captiveportal
33
*/
34

    
35
##|+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
require("guiconfig.inc");
43
require("functions.inc");
44
require("filter.inc");
45
require("shaper.inc");
46
require("captiveportal.inc");
47

    
48
$cpzone = $_GET['zone'];
49
if (isset($_POST['zone']))
50
	$cpzone = $_POST['zone'];
51

    
52
if ($_GET['act'] == "del" && !empty($cpzone)) {
53
	captiveportal_disconnect_client($_GET['id']);
54
	Header("Location: status_captiveportal.php?zone={$cpzone}");
55
	exit;
56
}
57

    
58
$pgtitle = array(gettext("Status: Captive portal"));
59
$shortcut_section = "captiveportal";
60

    
61
if (!is_array($config['captiveportal']))
62
        $config['captiveportal'] = array();
63
$a_cp =& $config['captiveportal'];
64

    
65
include("head.inc");
66

    
67
?>
68

    
69
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
70
<?php include("fbegin.inc"); ?>
71
<?php
72

    
73
flush();
74

    
75
function clientcmp($a, $b) {
76
	global $order;
77
	return strcmp($a[$order], $b[$order]);
78
}
79

    
80
if (!empty($cpzone)) {
81
	$cpdb = captiveportal_read_db();
82

    
83
	if ($_GET['order']) {
84
		if ($_GET['order'] == "ip")
85
			$order = 2;
86
		else if ($_GET['order'] == "mac")
87
			$order = 3;
88
		else if ($_GET['order'] == "user")
89
			$order = 4;
90
		else if ($_GET['order'] == "lastact")
91
			$order = 5;
92
		else
93
			$order = 0;
94
		usort($cpdb, "clientcmp");
95
	}
96
}
97

    
98
?>
99

    
100
<?php if (!empty($cpzone) && isset($config['voucher'][$cpzone]['enable'])): ?>
101
<form action="status_captiveportal.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
102
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="tab pane">
103
<tr><td class="tabnavtbl">
104
<?php 
105
	$tab_array = array();
106
        $tab_array[] = array(gettext("Active Users"), true, "status_captiveportal.php?zone={$cpzone}");
107
        $tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}");
108
        $tab_array[] = array(gettext("Voucher Rolls"), false, "status_captiveportal_voucher_rolls.php?zone={$cpzone}");
109
        $tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}");
110
	$tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}");
111
        display_top_tabs($tab_array);
112
?> 
113
</td></tr>
114
<tr>
115
<td class="tabcont">
116
<?php endif; ?>
117

    
118
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
119
  <tr>
120
	<td width="20%" class="vncell" valign="top"> 
121
               <br/><?=gettext("Captive Portal Zone"); ?><br/<br/>
122
	</td>
123
	<td "class="vncell" width="30%" align="center"> 
124
	<form action="status_captiveportal.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
125
		<select name="zone" class="formselect" onchange="document.form1.submit()">
126
		echo "<option value="">none</option>\n";
127
		<?php foreach ($a_cp as $cpkey => $cp) {
128
		       echo "<option value='{$cpkey}' ";
129
		       if ($cpzone == $cpkey)
130
			       echo "selected";
131
		       echo ">" . htmlspecialchars($cp['zone']) . "</option>\n";
132
		       }
133
               ?>
134
               </select>
135
		<br/>
136
	</form>
137
	</td>
138
	<td colspan="3" width="50%"></td>
139
  </tr>
140
  <tr><td colspan="5"><br/></tr>
141
<?php if (!empty($cpzone)): ?>
142
  <tr>
143
	<td colspan="5" valign="top" class="listtopic"><?=gettext("Captiveportal status");?></td>
144
  </tr>
145
  <tr>
146
    <td class="listhdrr"><a href="?order=ip&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("IP address");?></a></td>
147
    <td class="listhdrr"><a href="?order=mac&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("MAC address");?></a></td>
148
    <td class="listhdrr"><a href="?order=user&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("Username");?></a></td>
149
	<?php if ($_GET['showact']): ?>
150
    <td class="listhdrr"><a href="?order=start&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("Session start");?></a></td>
151
    <td class="listhdr"><a href="?order=lastact&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("Last activity");?></a></td>
152
	<?php else: ?>
153
    <td class="listhdr"><a href="?order=start&amp;showact=<?=htmlspecialchars($_GET['showact']);?>"><?=gettext("Session start");?></a></td>
154
	<?php endif; ?>
155
    <td class="list sort_ignore"></td>
156
  </tr>
157
<?php foreach ($cpdb as $cpent): ?>
158
  <tr>
159
    <td class="listlr"><?=$cpent[2];?></td>
160
    <td class="listr"><?=$cpent[3];?>&nbsp;</td>
161
    <td class="listr"><?=$cpent[4];?>&nbsp;</td>
162
    <td class="listr"><?=htmlspecialchars(date("m/d/Y H:i:s", $cpent[0]));?></td>
163
	<?php if ($_GET['showact']):
164
	$last_act = captiveportal_get_last_activity($cpent[2]); ?>
165
    <td class="listr"><?php if ($last_act != 0) echo htmlspecialchars(date("m/d/Y H:i:s", $last_act));?></td>
166
	<?php endif; ?>
167
	<td valign="middle" class="list" nowrap>
168
	<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>
169
  </tr>
170
<?php endforeach; endif; ?>
171
</table>
172

    
173
<?php if (!empty($cpzone) && isset($config['voucher'][$cpzone]['enable'])): ?>
174
</td>
175
</tr>
176
</table>
177
</form>
178
<?php endif; ?>
179

    
180
<form action="status_captiveportal.php" method="get" style="margin: 14px;">
181
<input type="hidden" name="order" value="<?=$_GET['order'];?>" />
182
<?php if (!empty($cpzone)): ?>
183
<?php if ($_GET['showact']): ?>
184
<input type="hidden" name="showact" value="0" />
185
<input type="submit" class="formbtn" value="<?=gettext("Don't show last activity");?>" />
186
<?php else: ?>
187
<input type="hidden" name="showact" value="1" />
188
<input type="submit" class="formbtn" value="<?=gettext("Show last activity");?>" />
189
<?php endif; ?>
190
<input type="hidden" name="zone" value="<?=$cpzone;?>" />
191
<?php endif; ?>
192
</form>
193
<?php include("fend.inc"); ?>
194

    
195
</body>
196
</html>
(174-174/249)