Projet

Général

Profil

Télécharger (4,42 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / status_captiveportal_expire.php @ 0fab7eb1

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
include("fbegin.inc");
62
?>
63

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

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

    
115
include("fend.inc");
116
?>
117

    
(179-179/254)