/tmp/hostapddata", $return ); system( "sudo cp /tmp/hostapddata " . RASPI_HOSTAPD_CONFIG, $return ); if( $return == 0 ) { $status->addMessage('Wifi Hotspot settings saved', 'success'); } else { $status->addMessage('Wifi Hotspot settings failed to be saved', 'danger'); } } 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'); } $arrConfig = array(); $arrChannel = array('a','b','g'); $arrSecurity = array( 1 => 'WPA', 2 => 'WPA2',3=> 'WPA+WPA2'); $arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP'); foreach( $return as $a ) { if( $a[0] != "#" ) { $arrLine = explode( "=",$a) ; $arrConfig[$arrLine[0]]=$arrLine[1]; } }; ?>
Configure hotspot

showMessages(); ?>

Basic settings

Security settings

'TKIP+CCMP' but I am not yet sure what * exactly is correct. * At I read it, 'TKIP CCMP' would get written to the * hostapd.conf file when it is saved but the correct option * would only be selected if it reads 'TKIP+CCMP'. This is * clearly broken. * Now it is consistent, albeit possibly still broken. */ ?>

Advanced settings

'; } else { echo ''; }; ?>
"; } } elseif( isset($_POST['StopOpenVPN']) ) { echo "Attempting to stop openvpn"; exec( 'sudo /etc/init.d/openvpn stop', $return ); foreach( $return as $line ) { echo $line."
"; } } elseif( isset($_POST['StartTOR']) ) { echo "Attempting to start TOR"; exec( 'sudo /etc/init.d/tor start', $return ); foreach( $return as $line ) { echo $line."
"; } } elseif( isset($_POST['StopTOR']) ) { echo "Attempting to stop TOR"; exec( 'sudo /etc/init.d/tor stop', $return ); foreach( $return as $line ) { echo $line."
"; } } } ?>