Fixed up PHP notices. Added text when IP Address, MAC Address, and Subnet mask aren't found.

Also added function to backup configuration files /etc/network/interfaces and /etc/hostapd/hostapd.conf files if found.
This commit is contained in:
Lawrence
2017-10-01 20:54:16 +08:00
parent 97fd8dc13e
commit a36e525f98
2 changed files with 21 additions and 7 deletions

View File

@@ -15,19 +15,19 @@ function DisplayDashboard(){
$strWlan0 = preg_replace( '/\s\s+/', ' ', $strWlan0 );
// Parse results from ifconfig/iwconfig
preg_match( '/HWaddr ([0-9a-f:]+)/i',$strWlan0,$result );
preg_match( '/HWaddr ([0-9a-f:]+)/i',$strWlan0,$result ) || $result[1] = 'No MAC Address Found';
$strHWAddress = $result[1];
preg_match( '/inet addr:([0-9.]+)/i',$strWlan0,$result );
preg_match( '/inet addr:([0-9.]+)/i',$strWlan0,$result ) || $result[1] = 'No IP Address Found';
$strIPAddress = $result[1];
preg_match( '/Mask:([0-9.]+)/i',$strWlan0,$result );
preg_match( '/Mask:([0-9.]+)/i',$strWlan0,$result ) || $result[1] = 'No Subnet Mask Found';
$strNetMask = $result[1];
preg_match( '/RX packets:(\d+)/',$strWlan0,$result );
preg_match( '/RX packets:(\d+)/',$strWlan0,$result ) || $result[1] = 'No Data';
$strRxPackets = $result[1];
preg_match( '/TX packets:(\d+)/',$strWlan0,$result );
preg_match( '/TX packets:(\d+)/',$strWlan0,$result ) || $result[1] = 'No Data';
$strTxPackets = $result[1];
preg_match( '/RX bytes:(\d+ \(\d+.\d+ [K|M|G]iB\))/i',$strWlan0,$result );
preg_match( '/RX bytes:(\d+ \(\d+.\d+ [K|M|G]iB\))/i',$strWlan0,$result ) || $result[1] = 'No Data';
$strRxBytes = $result[1];
preg_match( '/TX Bytes:(\d+ \(\d+.\d+ [K|M|G]iB\))/i',$strWlan0,$result );
preg_match( '/TX Bytes:(\d+ \(\d+.\d+ [K|M|G]iB\))/i',$strWlan0,$result ) || $result[1] = 'No Data';
$strTxBytes = $result[1];
preg_match( '/ESSID:\"([a-zA-Z0-9\s]+)\"/i',$strWlan0,$result );
$strSSID = str_replace( '"','',$result[1] );