Skip to content

Commit

Permalink
Update sanitize var method
Browse files Browse the repository at this point in the history
  • Loading branch information
billz committed Mar 29, 2023
1 parent 1e52ff5 commit 7760a1d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions includes/hostapd.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ function DisplayHostAPDConfig()
$arrConfig['country_code'] = $country_code[0];
}
// set txpower with iw if value is non-default ('auto')
$txpower = escapeshellarg($_POST['txpower']);
$interface = escapeshellarg($_POST['interface']);
if ($txpower) && ($txpower != 'auto')) {
$sdBm = $txpower * 100;
exec('sudo /sbin/iw dev '.$interface.' set txpower fixed '.$sdBm, $return);
$status->addMessage('Setting transmit power to '.$txpower.' dBm.', 'success');
} elseif ($txpower == 'auto') {
exec('sudo /sbin/iw dev '.$interface.' set txpower auto', $return);
$status->addMessage('Setting transmit power to '.$txpower.'.', 'success');
if (isset($_POST['txpower']) && ($_POST['txpower'] != 'auto')) {
$txpower = intval($_POST['txpower']);
$sdBm = $txpower * 100;
exec('sudo /sbin/iw dev '.escapeshellarg($_POST['interface']).' set txpower fixed '.$sdBm, $return);
$status->addMessage('Setting transmit power to '.$_POST['txpower'].' dBm.', 'success');
$txpower = $_POST['txpower'];
} elseif ($_POST['txpower'] == 'auto') {
exec('sudo /sbin/iw dev '.escapeshellarg($_POST['interface']).' set txpower auto', $return);
$status->addMessage('Setting transmit power to '.$_POST['txpower'].'.', 'success');
$txpower = $_POST['txpower'];
}

$countries_5Ghz_max48ch = RASPI_5GHZ_ISO_ALPHA2;
Expand Down

0 comments on commit 7760a1d

Please sign in to comment.