/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]; } }; ?>