Revision 0d9fe84b
Added by Phil Davis about 10 years ago
usr/local/www/interfaces_ppps_edit.php | ||
---|---|---|
244 | 244 |
$input_errors[] = gettext("A valid PPPoE reset year must be specified. Don't select a year in the past!"); |
245 | 245 |
} |
246 | 246 |
|
247 |
foreach($_POST['interfaces'] as $iface){ |
|
248 |
if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) |
|
249 |
$input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."),$iface); |
|
250 |
if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface])) |
|
251 |
$input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."),$iface); |
|
252 |
if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface])) |
|
253 |
$input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."),$iface); |
|
254 |
if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576)) |
|
255 |
$input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."),$iface); |
|
256 |
if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576)) |
|
257 |
$input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."),$iface); |
|
247 |
if (is_array($_POST['interfaces'])) { |
|
248 |
foreach($_POST['interfaces'] as $iface){ |
|
249 |
if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) |
|
250 |
$input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."),$iface); |
|
251 |
if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface])) |
|
252 |
$input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."),$iface); |
|
253 |
if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface])) |
|
254 |
$input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."),$iface); |
|
255 |
if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576)) |
|
256 |
$input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."),$iface); |
|
257 |
if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576)) |
|
258 |
$input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."),$iface); |
|
259 |
} |
|
258 | 260 |
} |
259 | 261 |
|
260 | 262 |
/* |
Also available in: Unified diff
Interfaces PPPs edit avoid foreach() warning
If you go to Interfaces, assign, PPPs, press "+" to add an entry, then press Save without entering anything then you get a warning about the foreach() here.
The is_array() check fixes it.