Project

General

Profile

Download (4.48 KB) Statistics
| Branch: | Tag: | Revision:

univnautes / usr / local / www / status_captiveportal_expire.php @ a1b66bec

1
<?php
2
/*
3
    Copyright (C) 2007 Marcel Wiget <mwiget@mac.com>.
4
    All rights reserved.
5

    
6
    Redistribution and use in source and binary forms, with or without
7
    modification, are permitted provided that the following conditions are met:
8

    
9
    1. Redistributions of source code must retain the above copyright notice,
10
       this list of conditions and the following disclaimer.
11

    
12
    2. Redistributions in binary form must reproduce the above copyright
13
       notice, this list of conditions and the following disclaimer in the
14
       documentation and/or other materials provided with the distribution.
15

    
16
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
17
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
18
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
20
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
    POSSIBILITY OF SUCH DAMAGE.
26
*/
27
/*
28
	pfSense_MODULE:	captiveportal
29
*/
30

    
31
##|+PRIV
32
##|*IDENT=page-status-captiveportal-expire
33
##|*NAME=Status: Captive portal Expire Vouchers page
34
##|*DESCR=Allow access to the 'Status: Captive portal Expire Vouchers' page.
35
##|*MATCH=status_captiveportal_expire.php*
36
##|-PRIV
37

    
38
require("guiconfig.inc");
39
require("functions.inc");
40
require_once("filter.inc");
41
require("shaper.inc");
42
require("captiveportal.inc");
43
require_once("voucher.inc");
44

    
45
$cpzone = $_GET['zone'];
46
if (isset($_POST['zone']))
47
	$cpzone = $_POST['zone'];
48

    
49
if (empty($cpzone)) {
50
	header("Location: services_captiveportal_zones.php");
51
	exit;
52
}
53

    
54
if (!is_array($config['captiveportal']))
55
	$config['captiveportal'] = array();
56
$a_cp =& $config['captiveportal'];
57

    
58
$pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Expire Vouchers"), $a_cp[$cpzone]['zone']);
59

    
60
include("head.inc");
61
?>
62
<body>
63
<?php include("fbegin.inc"); ?>
64

    
65
<form action="status_captiveportal_expire.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
66
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="tab pane">
67
<tr><td class="tabnavtbl">
68
<?php
69
	$tab_array = array();
70
	$tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}");
71
	$tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}");
72
	$tab_array[] = array(gettext("Voucher Rolls"), false, "status_captiveportal_voucher_rolls.php?zone={$cpzone}");
73
	$tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}");
74
	$tab_array[] = array(gettext("Expire Vouchers"), true, "status_captiveportal_expire.php?zone={$cpzone}");
75
	display_top_tabs($tab_array);
76
?>
77
</td></tr>
78
<tr>
79
<td class="tabcont">
80

    
81
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="content pane">
82
  <tr>
83
    <td valign="top" class="vncellreq"><?=gettext("Voucher(s)"); ?></td>
84
    <td class="vtable">
85
    <textarea name="vouchers" cols="65" rows="3" id="vouchers" class="formpre"><?=htmlspecialchars($_POST['vouchers']);?></textarea>
86
    <br />
87
<?=gettext("Enter multiple vouchers separated by space or newline. All valid vouchers will be marked as expired"); ?>.</td>
88
  </tr>
89
  <tr>
90
    <td width="22%" valign="top">&nbsp;</td>
91
    <td width="78%">
92
    <input name="zone" type="hidden" value="<?=htmlspecialchars($cpzone);?>" />
93
    <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Submit"); ?>" />
94
    </td>
95
  </tr>
96
</table>
97
</td></tr></table>
98
</form>
99
<br/>
100
<?php
101
if ($_POST) {
102
    if ($_POST['vouchers']) {
103
        $result = voucher_expire($_POST['vouchers']);
104
        echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"4\" width=\"100%\" summary=\"results\">\n";
105
        if ( $result) {
106
            echo "<tr><td bgcolor=\"#D9DEE8\"><img src=\"/themes/{$g['theme']}/images/icons/icon_pass.gif\" alt=\"pass\" /></td>";
107
            echo "<td bgcolor=\"#D9DEE8\">Success</td></tr>";
108
        } else {
109
            echo "<tr><td bgcolor=\"#FFD9D1\"><img src=\"/themes/{$g['theme']}/images/icons/icon_block.gif\" alt=\"block\" /></td>";
110
            echo "<td bgcolor=\"#FFD9D1\">Error</td></tr>";
111
        }
112
        echo "</table>";
113
    }
114
}
115

    
116
include("fend.inc");
117
?>
118
</body>
119
</html>
(181-181/256)