Project

General

Profile

Download (5.17 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
#!/usr/local/bin/php
2
<?php
3 b46bfcf5 Bill Marquette
/* $Id$ */
4 5b237745 Scott Ullrich
/*
5
	vpn_pptp_users.php
6
	part of m0n0wall (http://m0n0.ch/wall)
7
	
8
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
9
	All rights reserved.
10
	
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13
	
14
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16
	
17
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20
	
21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32
33
require("guiconfig.inc");
34
35
if (!is_array($config['pptpd']['user'])) {
36
	$config['pptpd']['user'] = array();
37
}
38
pptpd_users_sort();
39
$a_secret = &$config['pptpd']['user'];
40
41
if ($_POST) {
42
43
	$pconfig = $_POST;
44
45
	if ($_POST['apply']) {
46
		$retval = 0;
47
		if (!file_exists($d_sysrebootreqd_path)) {
48
			config_lock();
49
			$retval = vpn_pptpd_configure();
50
			config_unlock();
51
		}
52
		$savemsg = get_std_save_message($retval);
53
		if ($retval == 0) {
54
			if (file_exists($d_pptpuserdirty_path))
55
				unlink($d_pptpuserdirty_path);
56
		}
57
	}
58
}
59
60
if ($_GET['act'] == "del") {
61
	if ($a_secret[$_GET['id']]) {
62
		unset($a_secret[$_GET['id']]);
63
		write_config();
64
		touch($d_pptpuserdirty_path);
65
		header("Location: vpn_pptp_users.php");
66
		exit;
67
	}
68
}
69
?>
70
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
71
<html>
72
<head>
73
<title><?=gentitle("VPN: PPTP: Users");?></title>
74
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
75
<link href="gui.css" rel="stylesheet" type="text/css">
76
</head>
77
78
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
79
<?php include("fbegin.inc"); ?>
80
<p class="pgtitle">VPN: PPTP: Users</p>
81
<form action="vpn_pptp_users.php" method="post">
82
<?php if ($savemsg) print_info_box($savemsg); ?>
83
<?php if (isset($config['pptpd']['radius']['enable']))
84
	print_info_box("Warning: RADIUS is enabled. The local user database will not be used."); ?>
85
<?php if (file_exists($d_pptpuserdirty_path)): ?><p>
86
<?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>
87
<input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes"></p>
88
<?php endif; ?>
89
<table width="100%" border="0" cellpadding="0" cellspacing="0">
90
  <tr><td>
91
  <ul id="tabnav">
92
    <li class="tabinact"><a href="vpn_pptp.php">Configuration</a></li>
93
    <li class="tabact">Users</li>
94
  </ul>
95
  </td></tr>
96
  <tr> 
97
    <td colspan="3" class="tabcont">
98
              <table width="80%" border="0" cellpadding="0" cellspacing="0">
99
                <tr> 
100
                  <td class="listhdrr">Username</td>
101
                  <td class="listhdr">IP address</td>
102
                  <td class="list"></td>
103
				</tr>
104
			  <?php $i = 0; foreach ($a_secret as $secretent): ?>
105
                <tr> 
106 e68492cc Bill Marquette
                  <td class="listlr" ondblclick="document.location='vpn_pptp_users_edit.php?id=<?=$i;?>';">
107 5b237745 Scott Ullrich
                    <?=htmlspecialchars($secretent['name']);?>
108
                  </td>
109 e68492cc Bill Marquette
                  <td class="listr" ondblclick="document.location='vpn_pptp_users_edit.php?id=<?=$i;?>';">
110 5b237745 Scott Ullrich
                    <?=htmlspecialchars($secretent['ip']);?>&nbsp;
111
                  </td>
112 a339c26a Bill Marquette
                  <td class="list" nowrap>
113
                    <table border="0" cellspacing="0" cellpadding="1">
114
                      <tr>
115
                        <td valign="middle"><a href="vpn_pptp_users_edit.php?id=<?=$i;?>"><img src="e.gif" width="17" height="17" border="0"></a></td>
116
                        <td valign="middle"><a href="vpn_pptp_users.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this user?')"><img src="x.gif" width="17" height="17" border="0"></a></td>
117
                      </tr>
118
                    </table>
119
                  </td>
120
		</tr>
121
		<?php $i++; endforeach; ?>
122 5b237745 Scott Ullrich
                <tr> 
123
                  <td class="list" colspan="2"></td>
124 a339c26a Bill Marquette
                  <td class="list">
125
                    <table border="0" cellspacing="0" cellpadding="1">
126
                      <tr>
127
                        <td valign="middle"><a href="vpn_pptp_users_edit.php"><img src="plus.gif" width="17" height="17" border="0"></a></td>
128
                      </tr>
129
                    </table>
130
                  </td>
131
		</tr>
132 5b237745 Scott Ullrich
              </table>
133 a339c26a Bill Marquette
            </td>
134
          </tr>
135
        </table>
136 5b237745 Scott Ullrich
</form>
137
<?php include("fend.inc"); ?>
138
</body>
139
</html>