Client settings
2 ) {
exec( 'wpa_passphrase '.$ssid. ' ' . $psk,$network );
foreach($network as $b) {
$config .= "$b
";
}
}
}
exec( "echo '$config' > /tmp/wifidata", $return );
system( 'sudo cp /tmp/wifidata ' . RASPI_WPA_SUPPLICANT_CONFIG, $returnval );
if( $returnval == 0 ) {
echo '
Wifi settings updated successfully
';
} else {
echo '
Wifi settings failed to be updated
';
}
// scan networks
} elseif( isset($_POST['Scan']) ) {
$return = '';
exec( 'sudo wpa_cli scan',$return );
sleep(3);
exec( 'sudo wpa_cli scan_results',$return );
for( $shift = 0; $shift < 4; $shift++ ) {
array_shift($return);
}
// display output
echo '
';
} else {
$status = '
OpenVPN is running
';
}
// parse client settings
foreach( $returnClient as $a ) {
if( $a[0] != "#" ) {
$arrLine = explode( " ",$a) ;
$arrClientConfig[$arrLine[0]]=$arrLine[1];
}
}
// parse server settings
foreach( $returnServer as $a ) {
if( $a[0] != "#" ) {
$arrLine = explode( " ",$a) ;
$arrServerConfig[$arrLine[0]]=$arrLine[1];
}
}
?>
';
} else {
$status = '
TOR is running
';
}
foreach( $return as $a ) {
if( $a[0] != "#" ) {
$arrLine = explode( " ",$a) ;
$arrConfig[$arrLine[0]]=$arrLine[1];
}
}
?>
";
}
} 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."
";
}
}
}
?>