Project

General

Profile

Download (4.54 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
#!/usr/local/bin/php
2
<?php
3
/*
4
	vpn_pptp_users.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6
	
7 e2411886 Scott Ullrich
	Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
8 5b237745 Scott Ullrich
	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['pptpd']['user'])) {
35
	$config['pptpd']['user'] = array();
36
}
37
pptpd_users_sort();
38
$a_secret = &$config['pptpd']['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_pptpd_configure();
49
			config_unlock();
50
		}
51
		$savemsg = get_std_save_message($retval);
52
		if ($retval == 0) {
53
			if (file_exists($d_pptpuserdirty_path))
54
				unlink($d_pptpuserdirty_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_pptpuserdirty_path);
64
		header("Location: vpn_pptp_users.php");
65
		exit;
66
	}
67
}
68 4df96eff Scott Ullrich
69 b128368a Bill Marquette
$pgtitle = "VPN: PPTP: Users";
70 4df96eff Scott Ullrich
include("head.inc");
71
72 5b237745 Scott Ullrich
?>
73 422f27c0 Scott Ullrich
74
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
75 5b237745 Scott Ullrich
<?php include("fbegin.inc"); ?>
76 b128368a Bill Marquette
<p class="pgtitle"><?=$pgtitle?></p>
77 5b237745 Scott Ullrich
<form action="vpn_pptp_users.php" method="post">
78
<?php if ($savemsg) print_info_box($savemsg); ?>
79
<?php if (isset($config['pptpd']['radius']['enable']))
80
	print_info_box("Warning: RADIUS is enabled. The local user database will not be used."); ?>
81
<?php if (file_exists($d_pptpuserdirty_path)): ?><p>
82
<?php print_info_box_np("The PPTP 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 PPTP sessions!</b>");?><br>
83
<?php endif; ?>
84
<table width="100%" border="0" cellpadding="0" cellspacing="0">
85 e2411886 Scott Ullrich
  <tr><td class="tabnavtbl">
86 17982382 Scott Ullrich
<?php
87
	$tab_array = array();
88
	$tab_array[0] = array("Configuration", false, "vpn_pptp.php");
89
	$tab_array[1] = array("Users", true, "vpn_pptp_users.php");
90
	display_top_tabs($tab_array);
91
?>    </td></tr>
92 5b237745 Scott Ullrich
  <tr> 
93 4806cf1e Bill Marquette
	<td>
94
        <div id="mainarea">
95
              <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
96 5b237745 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 e2411886 Scott Ullrich
                  <td class="listlr">
104 5b237745 Scott Ullrich
                    <?=htmlspecialchars($secretent['name']);?>
105
                  </td>
106 e2411886 Scott Ullrich
                  <td class="listr">
107 5b237745 Scott Ullrich
                    <?=htmlspecialchars($secretent['ip']);?>&nbsp;
108
                  </td>
109 677c0869 Erik Kristensen
                  <td class="list" nowrap> <a href="vpn_pptp_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_pptp_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 e2411886 Scott Ullrich
				</tr>
112
			  <?php $i++; endforeach; ?>
113 5b237745 Scott Ullrich
                <tr> 
114
                  <td class="list" colspan="2"></td>
115 677c0869 Erik Kristensen
                  <td class="list"> <a href="vpn_pptp_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 e2411886 Scott Ullrich
				</tr>
117 5b237745 Scott Ullrich
              </table>
118 949202c2 Bill Marquette
</div>
119 e2411886 Scott Ullrich
			</td>
120
	</tr>
121
</table>
122 5b237745 Scott Ullrich
</form>
123
<?php include("fend.inc"); ?>
124 9999b3aa Scott Ullrich
</body>
125
</html>