diff --git a/includes/functions.php b/includes/functions.php index 8f835ab6..98a2d691 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -89,8 +89,13 @@ function isAssoc($arr) { * If $options is an associative array this should be the key * */ -function SelectorOptions($name, $options, $selected = null) { - echo '' , PHP_EOL; foreach ( $options as $opt => $label) { $select = ''; $key = isAssoc($options) ? $opt : $label; diff --git a/includes/hostapd.php b/includes/hostapd.php index f484fb0c..4314aaff 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -6,22 +6,21 @@ include_once( 'includes/status_messages.php' ); * * */ -function DisplayHostAPDConfig(){ - +function DisplayHostAPDConfig() +{ $status = new StatusMessages(); $arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini'); $arrConfig = array(); - $arrChannel = array('a','b','g'); + $arr80211Standard = array('a','b','g','n'); $arrSecurity = array( 1 => 'WPA', 2 => 'WPA2',3=> 'WPA+WPA2'); $arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP'); exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces); - if( isset($_POST['SaveHostAPDSettings']) ) { if (CSRFValidate()) { - SaveHostAPDConfig($arrSecurity, $arrEncType, $arrChannel, $interfaces, $status); + SaveHostAPDConfig($arrSecurity, $arrEncType, $arr80211Standard, $interfaces, $status); } else { error_log('CSRF violation'); } @@ -47,7 +46,7 @@ function DisplayHostAPDConfig(){ } } - exec( 'cat '. RASPI_HOSTAPD_CONFIG, $return ); + exec( 'cat '. RASPI_HOSTAPD_CONFIG, $hostapdconfig ); exec( 'pidof hostapd | wc -l', $hostapdstatus); if( $hostapdstatus[0] == 0 ) { @@ -56,9 +55,13 @@ function DisplayHostAPDConfig(){ $status->addMessage('HostAPD is running', 'success'); } - foreach( $return as $a ) { - if( $a[0] != "#" ) { - $arrLine = explode( "=",$a) ; + foreach( $hostapdconfig as $hostapdconfigline ) { + if (strlen($hostapdconfigline) === 0) { + continue; + } + + if ($hostapdconfigline[0] != "#" ) { + $arrLine = explode("=", $hostapdconfigline) ; $arrConfig[$arrLine[0]]=$arrLine[1]; } }; @@ -88,28 +91,55 @@ function DisplayHostAPDConfig(){
- +
- - + +
- - + +
- - + +
@@ -117,20 +147,20 @@ function DisplayHostAPDConfig(){

- - + +
- - + +
- - + +
@@ -154,24 +184,24 @@ function DisplayHostAPDConfig(){
-
- + - @@ -424,7 +454,7 @@ if ($arrHostapdConf['LogEnable'] == 1) {