Project

General

Profile

Download (26.5 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
	vpn_pppoe_edit.php
4
	part of pfSense
5
	
6
	Copyright (C) 2005 Scott Ullrich (sullrich@gmail.com)
7
	Copyright (C) 2010 Ermal Lu?i
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
##|+PRIV
33
##|*IDENT=page-services-pppoeserver-eidt
34
##|*NAME=Services: PPPoE Server: Edit page
35
##|*DESCR=Allow access to the 'Services: PPPoE Server: Edit' page.
36
##|*MATCH=vpn_pppoe_edit.php*
37
##|-PRIV
38

    
39
require("guiconfig.inc");
40
require_once("vpn.inc");
41

    
42
function vpn_pppoe_get_id() {
43
	global $config;
44

    
45
	$vpnid = 1;
46
	if (!is_array($config['pppoes']['pppoe'])) {
47
		foreach ($config['pppoes']['pppoe'] as $pppoe) {
48
			if ($vpnid == $pppoe['id'])
49
				$vpnid++;
50
			else
51
				return $vpnid; 
52
		}
53
	}
54

    
55
	return $vpnid;
56
}
57

    
58
if (!is_array($config['pppoes']['pppoe'])) {
59
	$config['pppoes']['pppoe'] = array();
60
}
61
$a_pppoes = &$config['pppoes']['pppoe'];
62

    
63
$id = $_GET['id'];
64
if (isset($_POST['id']))
65
        $id = $_POST['id'];
66

    
67
if (isset($id) && $a_pppoes[$id]) {
68
	$pppoecfg =& $a_pppoes[$id];
69

    
70
	$pconfig['remoteip'] = $pppoecfg['remoteip'];
71
	$pconfig['localip'] = $pppoecfg['localip'];
72
	$pconfig['mode'] = $pppoecfg['mode'];
73
	$pconfig['interface'] = $pppoecfg['interface'];
74
	$pconfig['n_pppoe_units'] = $pppoecfg['n_pppoe_units'];
75
	$pconfig['pppoe_subnet'] = $pppoecfg['pppoe_subnet'];
76
	$pconfig['pppoe_dns1'] = $pppoecfg['dns1'];
77
	$pconfig['pppoe_dns2'] = $pppoecfg['dns2'];
78
	$pconfig['descr'] = $pppoecfg['descr'];
79
	$pconfig['username'] = $pppoecfg['username'];
80
	$pconfig['pppoeid'] = $pppoecfg['pppoeid'];
81
	if (is_array($pppoecfg['radius'])) {
82
		$pconfig['radacct_enable'] = isset($pppoecfg['radius']['accounting']);
83
		$pconfig['radiusissueips'] = isset($pppoecfg['radius']['radiusissueips']);
84
		if (is_array($pppoecfg['radius']['server'])) {
85
			$pconfig['radiusenable'] = isset($pppoecfg['radius']['server']['enable']);
86
			$pconfig['radiusserver'] = $pppoecfg['radius']['server']['ip'];
87
			$pconfig['radiusserverport'] = $pppoecfg['radius']['server']['port'];
88
			$pconfig['radiusserveracctport'] = $pppoecfg['radius']['server']['acctport'];
89
			$pconfig['radiussecret'] = $pppoecfg['radius']['server']['secret'];
90
		}
91
		if (is_array($pppoecfg['radius']['server2'])) {
92
			$pconfig['radiussecenable'] = isset($pppoecfg['radius']['server2']['enable']);
93
			$pconfig['radiusserver2'] = $pppoecfg['radius']['server2']['ip'];
94
			$pconfig['radiusserver2port'] = $pppoecfg['radius']['server2']['port'];
95
			$pconfig['radiusserver2acctport'] = $pppoecfg['radius']['server2']['acctport'];
96
			$pconfig['radiussecret2'] = $pppoecfg['radius']['server2']['secret2'];
97
		}
98
		$pconfig['radiusissueips'] = isset($pppoecfg['radius']['radiusissueips']);
99
		$pconfig['radius_nasip'] = $pppoecfg['radius']['nasip'];
100
		$pconfig['radius_acct_update'] = $pppoecfg['radius']['acct_update'];
101
	}
102
}
103

    
104

    
105
if ($_POST) {
106

    
107
	unset($input_errors);
108
	//$pconfig = $_POST;
109

    
110
	/* input validation */
111
	$reqdfields = explode(" ", "localip remoteip");
112
	$reqdfieldsn = array(gettext("Server address"),gettext("Remote start address"));
113

    
114
	if ($_POST['radiusenable']) {
115
		$reqdfields = array_merge($reqdfields, explode(" ", "radiusserver radiussecret"));
116
		$reqdfieldsn = array_merge($reqdfieldsn, 
117
			array(gettext("RADIUS server address"),gettext("RADIUS shared secret")));
118
	}
119

    
120
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
121

    
122
	if (($_POST['localip'] && !is_ipaddr($_POST['localip'])))
123
		$input_errors[] = gettext("A valid server address must be specified.");
124
	if (($_POST['pppoe_subnet'] && !is_ipaddr($_POST['remoteip'])))
125
		$input_errors[] = gettext("A valid remote start address must be specified.");
126
	if (($_POST['radiusserver'] && !is_ipaddr($_POST['radiusserver'])))
127
		$input_errors[] = gettext("A valid RADIUS server address must be specified.");
128

    
129
	$_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $_POST['pppoe_subnet']);
130
	$subnet_start = ip2ulong($_POST['remoteip']);
131
	$subnet_end = ip2ulong($_POST['remoteip']) + $_POST['pppoe_subnet'] - 1;
132
	if ((ip2ulong($_POST['localip']) >= $subnet_start) && 
133
	    (ip2ulong($_POST['localip']) <= $subnet_end))
134
		$input_errors[] = gettext("The specified server address lies in the remote subnet.");	
135
	if ($_POST['localip'] == get_interface_ip($_POST['interface']))
136
		$input_errors[] = gettext("The specified server address is equal to an interface ip address.");	
137

    
138
	for($x=0; $x<4999; $x++) {
139
		if ($_POST["username{$x}"]) {
140
			if (empty($_POST["password{$x}"]))
141
				$input_errors[] = gettext("No password specified for username ") . $_POST["username{$x}"];
142
			if ($_POST["ip{$x}"] <> "" && !is_ipaddr($_POST["ip{$x}"]))
143
				$input_errors[] = gettext("Incorrect ip address  specified for username ") . $_POST["username{$x}"];
144
		}
145
	}
146

    
147
	if (!$input_errors) {
148
		$pppoecfg = array();
149

    
150
		$pppoecfg['remoteip'] = $_POST['remoteip'];
151
		$pppoecfg['localip'] = $_POST['localip'];
152
		$pppoecfg['mode'] = $_POST['mode'];
153
		$pppoecfg['interface'] = $_POST['interface'];
154
		$pppoecfg['n_pppoe_units'] = $_POST['n_pppoe_units'];	
155
		$pppoecfg['pppoe_subnet'] = $_POST['pppoe_subnet'];
156
		$pppoecfg['descr'] = $_POST['descr'];
157
		if ($_POST['radiusserver'] || $_POST['radiusserver2']) {
158
			$pppoecfg['radius'] = array();
159

    
160
			$pppoecfg['radius']['nasip'] = $_POST['radius_nasip'];
161
                        $pppoecfg['radius']['acct_update'] = $_POST['radius_acct_update'];
162
		}
163
		if ($_POST['radiusserver']) {
164
			$pppoecfg['radius']['server'] = array();
165

    
166
			$pppoecfg['radius']['server']['ip'] = $_POST['radiusserver'];
167
			$pppoecfg['radius']['server']['secret'] = $_POST['radiussecret'];
168
			$pppoecfg['radius']['server']['port'] = $_POST['radiusserverport'];
169
			$pppoecfg['radius']['server']['acctport'] = $_POST['radiusserveracctport'];
170
		}
171
		if ($_POST['radiusserver']) {
172
			$pppoecfg['radius']['server2'] = array();
173

    
174
			$pppoecfg['radius']['server2']['ip'] = $_POST['radiusserver2'];
175
			$pppoecfg['radius']['server2']['secret2'] = $_POST['radiussecret2'];
176
			$pppoecfg['radius']['server2']['port'] = $_POST['radiusserver2port'];
177
			$pppoecfg['radius']['server2']['acctport'] = $_POST['radiusserver2acctport'];
178
		}
179

    
180
 		if ($_POST['pppoe_dns1'] <> "") 
181
			$pppoecfg['dns1'] = $_POST['pppoe_dns1'];
182

    
183
 		if ($_POST['pppoe_dns2'] <> "") 
184
			$pppoecfg['dns2'] = $_POST['pppoe_dns2'];
185

    
186
		if($_POST['radiusenable'] == "yes")
187
			$pppoecfg['radius']['server']['enable'] = true;
188
			
189
		if($_POST['radiussecenable'] == "yes")
190
			$pppoecfg['radius']['server2']['enable'] = true;
191
			
192
		if($_POST['radacct_enable'] == "yes")
193
			$pppoecfg['radius']['accounting'] = true;
194

    
195
		if($_POST['radiusissueips'] == "yes")
196
			$pppoecfg['radius']['radiusissueips'] = true;
197

    
198
		if($_POST['pppoeid'])
199
			$pppoecfg['pppoeid'] = $_POST['pppoeid'];
200
		else
201
			$pppoecfg['pppoeid'] = vpn_pppoe_get_id();
202

    
203
		$users = array();
204
		for($x=0; $x<4999; $x++) {
205
			if ($_POST["username{$x}"]) {
206
				$usernam = $_POST["username{$x}"] . ":" . $_POST["password{$x}"];
207
				if ($_POST["ip{$x}"])
208
					$usernam .= ":" . $_POST["ip{$x}"];
209
				$users[] = $usernam;
210
			}
211
		}
212
		if (count($users) > 0)
213
			$pppoecfg['username'] = implode(" ", $users);
214

    
215
		if (!isset($id))
216
                        $id = count($a_pppoes);
217
                if (file_exists("{$g['tmp_path']}/.vpn_pppoe.apply"))
218
                        $toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.vpn_pppoe.apply"));
219
                else
220
                        $toapplylist = array();
221

    
222
                $toapplylist[] = $pppoecfg['pppoeid'];
223
		$a_pppoes[$id] = $pppoecfg;
224

    
225
		write_config();
226
		mark_subsystem_dirty('vpnpppoe');
227
		file_put_contents("{$g['tmp_path']}/.vpn_pppoe.apply", serialize($toapplylist));	
228
		header("Location: vpn_pppoe.php");
229
		exit;
230
	}
231
}
232

    
233
$pgtitle = array(gettext("Services"),gettext("PPPoE Server"), gettext("Edit"));
234
include("head.inc");
235

    
236
?>
237

    
238
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
239
<?php include("fbegin.inc"); ?>
240
<script type="text/javascript" src="/javascript/row_helper.js">
241
</script>
242

    
243
<input type='hidden' name='username' value='textbox' class="formfld unknown" />
244
<input type='hidden' name='password' value='textbox' />
245
<input type='hidden' name='ip' value='textbox' />
246

    
247
<script type="text/javascript">
248
        rowname[0] = "username";
249
        rowtype[0] = "textbox";
250
        rowsize[0] = "20";
251

    
252
        rowname[1] = "password";
253
        rowtype[1] = "password";
254
        rowsize[1] = "20";
255

    
256
        rowname[2] = "ip";
257
        rowtype[2] = "textbox";
258
        rowsize[2] = "10";
259
</script>
260

    
261
<script language="JavaScript">
262
<!--
263
function get_radio_value(obj)
264
{
265
	for (i = 0; i < obj.length; i++) {
266
		if (obj[i].checked)
267
			return obj[i].value;
268
	}
269
	return null;
270
}
271

    
272
function enable_change(enable_over) {
273
	if ((get_radio_value(document.iform.mode) == "server") || enable_over) {
274
		document.iform.remoteip.disabled = 0;
275
		document.iform.descr.disabled = 0;
276
		document.iform.localip.disabled = 0;
277
		document.iform.radiusenable.disabled = 0;
278
		document.iform.interface.disabled = 0;
279
		document.iform.n_pppoe_units.disabled = 0;		
280
		document.iform.pppoe_subnet.disabled = 0;		
281
		document.iform.pppoe_dns1.disabled = 0;
282
		document.iform.pppoe_dns2.disabled = 0;		
283
		if (document.iform.radiusenable.checked || enable_over) {
284
			document.iform.radacct_enable.disabled = 0;
285
			document.iform.radiusserver.disabled = 0;
286
			document.iform.radiussecret.disabled = 0;
287
			document.iform.radiusserverport.disabled = 0;
288
			document.iform.radiusserveracctport.disabled = 0;
289
			document.iform.radiusissueips.disabled = 0;
290
			document.iform.radius_nasip.disabled = 0;
291
			document.iform.radiusissueips.disabled = 0;
292
			document.iform.radius_nasip.disabled = 0;
293
			document.iform.radius_acct_update.disabled = 0;
294
			document.iform.radiussecenable.disabled = 0;
295
			if (document.iform.radiussecenable.checked || enable_over) {
296
				document.iform.radiusserver2.disabled = 0;
297
				document.iform.radiussecret2.disabled = 0;
298
				document.iform.radiusserver2port.disabled = 0;
299
				document.iform.radiusserver2acctport.disabled = 0;
300
			} else {
301

    
302
				document.iform.radiusserver2.disabled = 1;
303
				document.iform.radiussecret2.disabled = 1;
304
				document.iform.radiusserver2port.disabled = 1;
305
				document.iform.radiusserver2acctport.disabled = 1;
306
			}
307
		} else {
308
			document.iform.radacct_enable.disabled = 1;
309
			document.iform.radiusserver.disabled = 1;
310
			document.iform.radiussecret.disabled = 1;
311
			document.iform.radiusserverport.disabled = 1;
312
			document.iform.radiusserveracctport.disabled = 1;
313
			document.iform.radiusissueips.disabled = 1;
314
			document.iform.radius_nasip.disabled = 1;
315
			document.iform.radius_acct_update.disabled = 1;
316
			document.iform.radiussecenable.disabled = 1;
317
		}
318
	} else {
319
		document.iform.interface.disabled = 1;
320
		document.iform.n_pppoe_units.disabled = 1;		
321
		document.iform.pppoe_subnet.disabled = 1;		
322
		document.iform.remoteip.disabled = 1;
323
		document.iform.descr.disabled = 1;
324
		document.iform.localip.disabled = 1;
325
		document.iform.pppoe_dns1.disabled = 1;
326
		document.iform.pppoe_dns2.disabled = 1;
327
		document.iform.radiusenable.disabled = 1;
328
		document.iform.radiussecenable.disabled = 1;
329
		document.iform.radacct_enable.disabled = 1;
330
		document.iform.radiusserver.disabled = 1;
331
		document.iform.radiussecret.disabled = 1;
332
		document.iform.radiusserverport.disabled = 1;
333
		document.iform.radiusserveracctport.disabled = 1;
334
		document.iform.radiusserver2.disabled = 1;
335
		document.iform.radiussecret2.disabled = 1;
336
		document.iform.radiusserver2port.disabled = 1;
337
		document.iform.radiusserver2acctport.disabled = 1;
338
		document.iform.radiusissueips.disabled = 1;
339
		document.iform.radius_nasip.disabled = 1;
340
		document.iform.radius_acct_update.disabled = 1;
341
	}
342
}
343
//-->
344
</script>
345
<form action="vpn_pppoe_edit.php" method="post" name="iform" id="iform">
346
<?php if ($input_errors) print_input_errors($input_errors); ?>
347
<?php if ($savemsg) print_info_box($savemsg); ?>
348
<table width="100%" border="0" cellpadding="0" cellspacing="0">
349
  <tr> 
350
    <td>
351
	<div id="mainarea">
352
              <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
353
		<tr>
354
                  <td height="16" colspan="2" class="listtopic" valign="top"><?php echo gettext("PPPoE server configuration"); ?></td>
355
                </tr>
356
                <tr> 
357
                  <td width="22%" valign="top" class="vtable">&nbsp;</td>
358
                  <td width="78%" class="vtable"> 
359
                    <input name="mode" type="radio" onclick="enable_change(false)" value="off"
360
				  	<?php if ($pconfig['mode'] != "server") echo "checked";?>>
361
                    <?=gettext("Off"); ?></td>
362
		</tr>
363
                <tr> 
364
                  <td width="22%" valign="top" class="vtable">&nbsp;</td>
365
                  <td width="78%" class="vtable">
366
		    <input type="radio" name="mode" value="server" onclick="enable_change(false)" <?php if ($pconfig['mode'] == "server") echo "checked"; ?>>
367
                    <?=gettext("Enable PPPoE server"); ?></td>
368
		</tr>
369

    
370
                <tr> 
371
                  <td width="22%" valign="top" class="vncell"><b><?=gettext("Interface"); ?></b></td>
372
                  <td width="78%" valign="top" class="vtable">
373

    
374
			<select name="interface" class="formselect" id="interface">
375
			  <?php
376
				$interfaces = get_configured_interface_with_descr();
377

    
378
				foreach ($interfaces as $iface => $ifacename):
379
			  ?>
380
			  <option value="<?=$iface;?>" <?php if ($iface == $pconfig['interface']) echo "selected"; ?>>
381
			  <?=htmlspecialchars($ifacename);?>
382
			  </option>
383
			  <?php endforeach; ?>
384
			</select> <br>			
385
                      
386
		  </td>
387
                </tr>
388
                <tr> 
389
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Subnet netmask"); ?></td>
390
                  <td width="78%" class="vtable">
391
		    <select id="pppoe_subnet" name="pppoe_subnet">
392
		    <?php
393
		     for($x=0; $x<33; $x++) {
394
			if($x == $pconfig['pppoe_subnet'])
395
				$SELECTED = " SELECTED";
396
			else
397
				$SELECTED = "";
398
			echo "<option value=\"{$x}\"{$SELECTED}>{$x}</option>\n";			
399
		     }
400
		    ?>
401
		    </select>
402
		    <br><?=gettext("Hint"); ?>: 24 <?=gettext("is"); ?> 255.255.255.0
403
                  </td>
404
		</tr>
405
                <tr> 
406
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("No. PPPoE users"); ?></td>
407
                  <td width="78%" class="vtable">
408
		    <select id="n_pppoe_units" name="n_pppoe_units">
409
		    <?php
410
		     for($x=0; $x<255; $x++) {
411
			if($x == $pconfig['n_pppoe_units'])
412
				$SELECTED = " SELECTED";
413
			else
414
				$SELECTED = "";
415
			echo "<option value=\"{$x}\"{$SELECTED}>{$x}</option>\n";			
416
		     }
417
		    ?>
418
		    </select>
419
		    <br><?=gettext("Hint: 10 is ten PPPoE clients"); ?>
420
                  </td>
421
		</tr>
422
                <tr> 
423
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Server address"); ?></td>
424
                  <td width="78%" class="vtable"> 
425
                    <?=$mandfldhtml;?><input name="localip" type="text" class="formfld unknown" id="localip" size="20" value="<?=htmlspecialchars($pconfig['localip']);?>"> 
426
                    <br>
427
                    <?=gettext("Enter the IP address the PPPoE server should use on its side " .
428
                    "for all clients"); ?>.</td>
429
                </tr>
430
                <tr> 
431
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Remote address range"); ?></td>
432
                  <td width="78%" class="vtable"> 
433
                    <?=$mandfldhtml;?><input name="remoteip" type="text" class="formfld unknown" id="remoteip" size="20" value="<?=htmlspecialchars($pconfig['remoteip']);?>">
434
                    <br>
435
                    <?=gettext("Specify the starting address for the client IP address subnet"); ?>.<br>
436
                    </td>
437
                </tr>
438
                <tr>
439
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Description"); ?></td>
440
                  <td width="78%" class="vtable">
441
                    <?=$mandfldhtml;?><input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>">
442
                    <br/>
443
                    </td>
444
                </tr>
445
                <tr> 
446
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("DNS servers"); ?></td>
447
                  <td width="78%" class="vtable"> 
448
                    <?=$mandfldhtml;?><input name="pppoe_dns1" type="text" class="formfld unknown" id="pppoe_dns1" size="20" value="<?=htmlspecialchars($pconfig['pppoe_dns1']);?>">
449
                    <br>
450
			<input name="pppoe_dns2" type="text" class="formfld unknown" id="pppoe_dns2" size="20" value="<?=htmlspecialchars($pconfig['pppoe_dns2']);?>">
451
                    <br>
452
                    <?=gettext("If entered they will be given to all PPPoE clients, else LAN DNS and one WAN DNS will go to all clients"); ?><br>
453
                    </td>
454
                </tr>
455
                <tr> 
456
                  <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS"); ?></td>
457
                  <td width="78%" class="vtable"> 
458
                      <input name="radiusenable" type="checkbox" id="radiusenable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radiusenable']) echo "checked"; ?>>
459
                      <strong><?=gettext("Use a RADIUS server for authentication"); ?><br>
460
                      </strong><?=gettext("When set, all users will be authenticated using " .
461
                      "the RADIUS server specified below. The local user database " .
462
                      "will not be used"); ?>.<br>
463
                      <br>
464
                      <input name="radacct_enable" type="checkbox" id="radacct_enable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radacct_enable']) echo "checked"; ?>>
465
                      <strong><?=gettext("Enable RADIUS accounting"); ?> <br>
466
			 <br>
467
                      </strong><?=gettext("Sends accounting packets to the RADIUS server"); ?>.<br>
468
                      <input name="radiussecenable" type="checkbox" id="radiussecenable" onclick="enable_change(false)" value="yes" <?php if ($pconfig['radiussecenable']) echo "checked"; ?>>
469
                      <strong><?=gettext("Use Backup RADIUS Server"); ?></strong><br>
470
                      <?=gettext("When set, if primary server fails all requests will be sent via backup server"); ?></td>
471
                </tr>
472
                <tr> 
473
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("NAS IP Address"); ?></td>
474
                  <td width="78%" class="vtable"> 
475
                    <?=$mandfldhtml;?><input name="radius_nasip" type="text" class="formfld unknown" id="radius_nasip" size="20" value="<?=htmlspecialchars($pconfig['radius_nasip']);?>">
476
                    <br><?=gettext("RADIUS server NAS IP Address"); ?><br>
477
                    </td>
478
                </tr>
479
                <tr> 
480
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("RADIUS Accounting Update"); ?></td>
481
                  <td width="78%" class="vtable"> 
482
                    <?=$mandfldhtml;?><input name="radius_acct_update" type="text" class="formfld unknown" id="radius_acct_update" size="20" value="<?=htmlspecialchars($pconfig['radius_acct_update']);?>">
483
                    <br><?=gettext("RADIUS accounting update period in seconds"); ?>
484
                    </td>
485
                </tr>
486
                <tr> 
487
                  <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS issued IPs"); ?></td>
488
                  <td width="78%" valign="top" class="vtable">
489
                      <input name="radiusissueips" value="yes" type="checkbox" class="formfld" id="radiusissueips"<?php if($pconfig['radiusissueips']) echo " CHECKED"; ?>>
490
                      <br><?=gettext("Issue IP Addresses via RADIUS server"); ?>.</td>
491
                </tr>
492
                <tr> 
493
                  <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS server Primary"); ?></td>
494
                  <td width="78%" class="vtable">
495
                      <input name="radiusserver" type="text" class="formfld unknown" id="radiusserver" size="20" value="<?=htmlspecialchars($pconfig['radiusserver']);?>">
496
			 <input name="radiusserverport" type="text" class="formfld unknown" id="radiusserverport" size="4" value="<?=htmlspecialchars($pconfig['radiusserverport']);?>">
497
			 <input name="radiusserveracctport" type="text" class="formfld unknown" id="radiusserveracctport" size="4" value="<?=htmlspecialchars($pconfig['radiusserveracctport']);?>">
498
                      <br><?=gettext("Enter the IP address, authentication port and accounting port (optional) of the RADIUS server."); ?><br>
499
			 <br> <?=gettext("standard port 1812 and 1813 accounting"); ?></td>
500
                </tr>
501
                <tr> 
502
                  <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS primary shared secret"); ?></td>
503
                  <td width="78%" valign="top" class="vtable">
504
                      <input name="radiussecret" type="password" class="formfld pwd" id="radiussecret" size="20" value="<?=htmlspecialchars($pconfig['radiussecret']);?>">
505
                      <br><?=gettext("Enter the shared secret that will be used to authenticate " .
506
                      "to the RADIUS server"); ?>.</td>
507
                </tr>
508
                <tr> 
509
                  <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS server Secondary"); ?></td>
510
                  <td width="78%" class="vtable">
511
                      <input name="radiusserver2" type="text" class="formfld unknown" id="radiusserver2" size="20" value="<?=htmlspecialchars($pconfig['radiusserver2']);?>">
512
			 <input name="radiusserver2port" type="text" class="formfld unknown" id="radiusserver2port" size="4" value="<?=htmlspecialchars($pconfig['radiusserver2port']);?>">
513
			 <input name="radiusserver2acctport" type="text" class="formfld unknown" id="radiusserver2acctport" size="4" value="<?=htmlspecialchars($pconfig['radiusserver2acctport']);?>">
514
                      <br><?=gettext("Enter the IP address, authentication port and accounting port (optional) of the backup RADIUS server."); ?><br>
515
			 <br> <?=gettext("standard port 1812 and 1813 accounting"); ?></td>
516
                </tr>
517
                <tr> 
518
                  <td width="22%" valign="top" class="vncell"><?=gettext("RADIUS secondary shared secret"); ?></td>
519
                  <td width="78%" valign="top" class="vtable">
520
                      <input name="radiussecret2" type="password" class="formfld pwd" id="radiussecret2" size="20" value="<?=htmlspecialchars($pconfig['radiussecret2']);?>">
521
                      <br>
522
                      <?=gettext("Enter the shared secret that will be used to authenticate " .
523
                      "to the RADIUS server"); ?>.</td>
524
                </tr>
525
		<tr>
526
			<td width="22%" valign="top" class="vncell"><div id="addressnetworkport"><?=gettext("User (s)");?></div></td>
527
			<td width="78%" class="vtable">
528
			<table id="usertable">
529
			<tbody>
530
			<tr>
531
				<td><div id="onecolumn"><?=gettext("Username");?></div></td>
532
				<td><div id="twocolumn"><?=gettext("Password");?></div></td>
533
				<td><div id="thirdcolumn"><?=gettext("IP");?></div></td>
534
			</tr>
535
		<?php	$counter = 0;
536
			$usernames = $pconfig['username'];
537
			if ($usernames <> "") {
538
				$item = explode(" ", $usernames);
539
				foreach($item as $ww) {
540
					$wws = explode(":", $ww);
541
					$user = $wws[0];
542
					$passwd = $wws[1];
543
					$ip = $wws[2];
544
                        		$tracker = $counter;
545
		?>
546
		<tr>
547
			<td>
548
				<input name="username<?php echo $tracker; ?>" type="text" class="formfld unknown" id="username<?php echo $tracker; ?>" size="20" value="<?=htmlspecialchars($user);?>" />
549
			</td>
550
			<td>
551
				<input name="password<?php echo $tracker; ?>" type="password" class="formfld pwd" id="password<?php echo $tracker; ?>" size="20" value="<?=htmlspecialchars($passwd);?>" />
552
			</td>
553
			<td>
554
				<input name="ip<?php echo $tracker; ?>" type="text" class="formfld unknown" id="ip<?php echo $tracker; ?>" size="10" value="<?=htmlspecialchars($ip);?>" />
555
			</td>
556
			<td>
557
				<input type="image" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" onclick="removeRow(this); return false;" value="<?=gettext("Delete");?>" />
558
			</td>
559
		</tr>
560
		<?php
561
					$counter++;
562
				} // end foreach
563
			} // end if
564
		?>
565
			</tbody>
566
			</table>
567
			<a onclick="javascript:addRowTo('usertable'); return false;" href="#">
568
        			<img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry");?>" />
569
      			</a>
570
                	</td>
571
		</tr>
572
                <tr> 
573
                  <td height="16" colspan="2" valign="top"></td>
574
                </tr>
575
                <tr> 
576
                  <td width="22%" valign="top">&nbsp;</td>
577
                  <td width="78%"> 
578
		<?php if (isset($id))
579
			echo "<input type='hidden' name='id' id='id' value='{$id}' >";
580
		?>
581
		<?php if (isset($pconfig['pppoeid']))
582
			echo "<input type='hidden' name='pppoeid' id='pppoeid' value='{$pppoeid}' >";
583
		?>
584
                    <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>"> 
585
                    <a href="vpn_pppoe.php"><input name="Cancel" type="button" class="formbtn" value="<?=gettext("Cancel"); ?>"></a> 
586
                  </td>
587
                </tr>
588
                <tr> 
589
                  <td width="22%" valign="top">&nbsp;</td>
590
                  <td width="78%"><span class="vexpl"><span class="red"><strong><?=gettext("Note"); ?>:<br>
591
                    </strong></span><?=gettext("don't forget to add a firewall rule to permit " .
592
                    "traffic from PPPoE clients"); ?>!</span></td>
593
                </tr>
594
              </table>
595
	   </div>
596
	 </td>
597
	</tr>
598
</table>
599
</form>
600
<script type="text/javascript">
601
enable_change(false);
602

    
603
field_counter_js = 3;
604
rows = 1;
605
totalrows = <?php echo $counter; ?>;
606
loaded = <?php echo $counter; ?>;
607

    
608
</script>
609
<?php include("fend.inc"); ?>
610
</body>
611
</html>
(215-215/220)