'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); } else { error_log('CSRF violation'); } } elseif( isset($_POST['StartHotspot']) ) { if (CSRFValidate()) { $status->addMessage('Attempting to start hotspot', 'info'); exec( 'sudo /etc/init.d/hostapd start', $return ); foreach( $return as $line ) { $status->addMessage($line, 'info'); } } else { error_log('CSRF violation'); } } elseif( isset($_POST['StopHotspot']) ) { if (CSRFValidate()) { $status->addMessage('Attempting to stop hotspot', 'info'); exec( 'sudo /etc/init.d/hostapd stop', $return ); foreach( $return as $line ) { $status->addMessage($line, 'info'); } } else { error_log('CSRF violation'); } } exec( 'cat '. RASPI_HOSTAPD_CONFIG, $return ); exec( 'pidof hostapd | wc -l', $hostapdstatus); if( $hostapdstatus[0] == 0 ) { $status->addMessage('HostAPD is not running', 'warning'); } else { $status->addMessage('HostAPD is running', 'success'); } foreach( $return as $a ) { if( $a[0] != "#" ) { $arrLine = explode( "=",$a) ; $arrConfig[$arrLine[0]]=$arrLine[1]; } }; ?>