Added support for hidding SSID. Implement idea from #247.

Signed-off-by: D9ping <D9ping@users.noreply.github.com>
This commit is contained in:
D9ping 2018-10-10 20:11:10 +02:00
parent 92f02fb698
commit ee41ed7e0f

View file

@ -183,18 +183,31 @@ if (in_array($arrConfig['country_code'], $countries_max11channels)) {
<h4><?php echo _("Advanced settings"); ?></h4>
<div class="row">
<div class="col-md-4">
<div class="form-check">
<label class="form-check-label" for="chxlogenable">
<?php echo _("Enable logging");
<div class="form-check">
<label class="form-check-label" for="chxlogenable"><?php echo _("Enable logging");
$checkedLogEnabled = '';
if ($arrHostapdConf['LogEnable'] == 1) {
$checkedLogEnabled = ' checked="checked"';
}
?>
</label>
<input id="chxlogenable" name="logEnable" type="checkbox" class="form-check-input" value="1"<?php echo $checkedLogEnabled; ?> />
</label>
<input id="chxlogenable" name="logEnable" type="checkbox" class="form-check-input" value="1"<?php echo $checkedLogEnabled; ?> />
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-check">
<label class="form-check-label" for="chxhiddenssid"><?php echo _("Hide SSID in broadcast");
$checkedHiddenSSID = '';
if ($arrConfig['ignore_broadcast_ssid'] == 1 || $arrConfig['ignore_broadcast_ssid'] == 2) {
$checkedHiddenSSID = ' checked="checked"';
}
?> </label>
<input id="chxhiddenssid" name="hiddenSSID" type="checkbox" class="form-check-input" value="1"<?php echo $checkedHiddenSSID; ?> />
</div>
</div>
</div>
<div class="row">
@ -538,6 +551,20 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
$good_input = false;
}
if (isset($_POST['hiddenSSID'])) {
if (!is_int((int)$_POST['hiddenSSID'])) {
$status->addMessage('Parameter hiddenSSID not a number.', 'danger');
$good_input = false;
} elseif ((int)$_POST['hiddenSSID'] < 0 || (int)$_POST['hiddenSSID'] >= 3) {
$status->addMessage('Parameter hiddenSSID contains invalid configuratie value.', 'danger');
$good_input = false;
} else {
$ignore_broadcast_ssid = $_POST['hiddenSSID'];
}
} else {
$ignore_broadcast_ssid = '0';
}
if (! in_array($_POST['interface'], $interfaces)) {
// The user is probably up to something here but it may also be a
// genuine error.
@ -577,6 +604,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
fwrite($tmp_file, 'wpa='.$_POST['wpa'].PHP_EOL);
fwrite($tmp_file, 'wpa_pairwise='.$_POST['wpa_pairwise'].PHP_EOL);
fwrite($tmp_file, 'country_code='.$_POST['country_code'].PHP_EOL);
fwrite($tmp_file, 'ignore_broadcast_ssid='.$ignore_broadcast_ssid.PHP_EOL);
fclose($tmp_file);
system( "sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $return );