Indicated connected network

This commit is contained in:
Joe Haig 2016-08-14 17:25:53 +00:00
parent b353dd77a8
commit 9492330196
1 changed files with 18 additions and 7 deletions

View File

@ -16,7 +16,7 @@ function DisplayWPAConfig(){
foreach($known_return as $line) {
if (preg_match('/network\s*=/', $line)) {
$network = array('visible' => false, 'configured' => true);
$network = array('visible' => false, 'configured' => true, 'connected' => false);
} elseif ($network !== null) {
if (preg_match('/^\s*}\s*$/', $line)) {
$networks[$ssid] = $network;
@ -126,10 +126,18 @@ function DisplayWPAConfig(){
'protocol' => ConvertToSecurity($arrNetwork[3]),
'channel' => ConvertToChannel($arrNetwork[1]),
'passphrase' => '',
'visible' => true
'visible' => true,
'connected' => false
);
}
}
exec( 'iwconfig wlan0', $iwconfig_return );
foreach ($iwconfig_return as $line) {
if (preg_match( '/ESSID:\"(.+)\"/i',$line,$iwconfig_ssid )) {
$networks[$iwconfig_ssid[1]]['connected'] = true;
}
}
?>
<div class="row">
@ -156,11 +164,14 @@ function DisplayWPAConfig(){
<?php $index = 0; ?>
<?php foreach ($networks as $ssid => $network) { ?>
<tr>
<?php if ($network['configured']) { ?>
<td><i class="fa fa-check-circle fa-fw"></i></td>
<?php } else { ?>
<td></td>
<?php } ?>
<td>
<?php if ($network['configured']) { ?>
<i class="fa fa-check-circle fa-fw"></i>
<?php } ?>
<?php if ($network['connected']) { ?>
<i class="fa fa-exchange fa-fw"></i>
<?php } ?>
</td>
<td>
<input type="hidden" name="ssid<?php echo $index ?>" value="<?php echo $ssid ?>" />
<?php echo $ssid ?>