Project

General

Profile

Download (4.54 KB) Statistics
| Branch: | Tag: | Revision:
1 06e69b03 Scott Ullrich
#!/usr/local/bin/php
2
<?php
3
/*
4
	vpn_pppoe_users.php
5
	part of pfSense
6
	
7
	Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
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
require("guiconfig.inc");
33
34
if (!is_array($config['pppoe']['user'])) {
35
	$config['pppoe']['user'] = array();
36
}
37
pppoe_users_sort();
38
$a_secret = &$config['pppoe']['user'];
39
40
if ($_POST) {
41
42
	$pconfig = $_POST;
43
44
	if ($_POST['apply']) {
45
		$retval = 0;
46
		if (!file_exists($d_sysrebootreqd_path)) {
47
			config_lock();
48
			$retval = vpn_pppoe_configure();
49
			config_unlock();
50
		}
51
		$savemsg = get_std_save_message($retval);
52
		if ($retval == 0) {
53
			if (file_exists($d_pppoeuserdirty_path))
54
				unlink($d_pppoeuserdirty_path);
55
		}
56
	}
57
}
58
59
if ($_GET['act'] == "del") {
60
	if ($a_secret[$_GET['id']]) {
61
		unset($a_secret[$_GET['id']]);
62
		write_config();
63
		touch($d_pppoeuserdirty_path);
64
		header("Location: vpn_pppoe_users.php");
65
		exit;
66
	}
67
}
68
69 d844e31d Scott Ullrich
$pgtitle = "VPN: PPPoE: Users";
70 06e69b03 Scott Ullrich
include("head.inc");
71
72
?>
73
74
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
75
<?php include("fbegin.inc"); ?>
76
<p class="pgtitle"><?=$pgtitle?></p>
77
<form action="vpn_pppoe_users.php" method="post">
78
<?php if ($savemsg) print_info_box($savemsg); ?>
79
<?php if (isset($config['pppoe']['radius']['enable']))
80
	print_info_box("Warning: RADIUS is enabled. The local user database will not be used."); ?>
81
<?php if (file_exists($d_pppoeuserdirty_path)): ?><p>
82 d844e31d Scott Ullrich
<?php print_info_box_np("The PPPoE user list has been modified.<br>You must apply the changes in order for them to take effect.<br><b>Warning: this will terminate all current PPPoE sessions!</b>");?><br>
83 06e69b03 Scott Ullrich
<?php endif; ?>
84
<table width="100%" border="0" cellpadding="0" cellspacing="0">
85
  <tr><td class="tabnavtbl">
86
<?php
87
	$tab_array = array();
88
	$tab_array[0] = array("Configuration", false, "vpn_pppoe.php");
89
	$tab_array[1] = array("Users", true, "vpn_pppoe_users.php");
90
	display_top_tabs($tab_array);
91
?>    </td></tr>
92
  <tr> 
93 4806cf1e Bill Marquette
	<td>
94
         <div id="mainarea">
95
              <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
96 06e69b03 Scott Ullrich
                <tr> 
97
                  <td class="listhdrr">Username</td>
98
                  <td class="listhdr">IP address</td>
99
                  <td class="list"></td>
100
				</tr>
101
			  <?php $i = 0; foreach ($a_secret as $secretent): ?>
102
                <tr> 
103
                  <td class="listlr">
104
                    <?=htmlspecialchars($secretent['name']);?>
105
                  </td>
106
                  <td class="listr">
107
                    <?=htmlspecialchars($secretent['ip']);?>&nbsp;
108
                  </td>
109
                  <td class="list" nowrap> <a href="vpn_pppoe_users_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="edit user" width="17" height="17" border="0"></a>
110
                     &nbsp;<a href="vpn_pppoe_users.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this user?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="delete user" width="17" height="17" border="0"></a></td>
111
				</tr>
112
			  <?php $i++; endforeach; ?>
113
                <tr> 
114
                  <td class="list" colspan="2"></td>
115
                  <td class="list"> <a href="vpn_pppoe_users_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="add user" width="17" height="17" border="0"></a></td>
116
				</tr>
117
              </table>
118 6d4ac2e3 Bill Marquette
</div>
119 06e69b03 Scott Ullrich
			</td>
120
	</tr>
121
</table>
122
</form>
123
<?php include("fend.inc"); ?>
124
</body>
125
</html>
126