diff --git a/includes/dashboard.php b/includes/dashboard.php index b377cbf0..6a40c4c2 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -29,19 +29,19 @@ function DisplayDashboard(){ $strRxBytes = $result[1]; 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 ); + preg_match( '/ESSID:\"([a-zA-Z0-9\s]+)\"/i',$strWlan0,$result ) || $result[1] = 'Not connected'; $strSSID = str_replace( '"','',$result[1] ); - preg_match( '/Access Point: ([0-9a-f:]+)/i',$strWlan0,$result ); + preg_match( '/Access Point: ([0-9a-f:]+)/i',$strWlan0,$result ) || $result[1] = ''; $strBSSID = $result[1]; - preg_match( '/Bit Rate=([0-9\.]+ Mb\/s)/i',$strWlan0,$result ); + preg_match( '/Bit Rate=([0-9\.]+ Mb\/s)/i',$strWlan0,$result ) || $result[1] = ''; $strBitrate = $result[1]; - preg_match( '/Tx-Power=([0-9]+ dBm)/i',$strWlan0,$result ); + preg_match( '/Tx-Power=([0-9]+ dBm)/i',$strWlan0,$result ) || $result[1] = ''; $strTxPower = $result[1]; - preg_match( '/Link Quality=([0-9]+)/i',$strWlan0,$result ); + preg_match( '/Link Quality=([0-9]+)/i',$strWlan0,$result ) || $result[1] = ''; $strLinkQuality = $result[1]; - preg_match( '/Signal level=(-?[0-9]+ dBm)/i',$strWlan0,$result ); + preg_match( '/Signal level=(-?[0-9]+ dBm)/i',$strWlan0,$result ) || $result[1] = ''; $strSignalLevel = $result[1]; - preg_match('/Frequency:(\d+.\d+ GHz)/i',$strWlan0,$result); + preg_match('/Frequency:(\d+.\d+ GHz)/i',$strWlan0,$result) || $result[1] = ''; $strFrequency = $result[1]; if(strpos( $strWlan0, "UP" ) !== false && strpos( $strWlan0, "RUNNING" ) !== false ) { diff --git a/includes/dhcp.php b/includes/dhcp.php index 0231d75d..465d56e4 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -78,6 +78,10 @@ function DisplayDHCPConfig() { $RangeMask = $arrRange[2]; preg_match( '/([0-9]*)([a-z])/i', $arrRange[3], $arrRangeLeaseTime ); + $hselected = ''; + $mselected = ''; + $dselected = ''; + switch( $arrRangeLeaseTime[2] ) { case "h": $hselected = " selected"; diff --git a/includes/system.php b/includes/system.php index ebcff351..e68725de 100755 --- a/includes/system.php +++ b/includes/system.php @@ -65,6 +65,7 @@ function DisplaySystem(){ if ($minutes != 0) { $uptime .= $minutes . ' minute' . (($minutes > 1)? 's ':' '); } // mem used + $memused_status = "primary"; exec("free -m | awk '/Mem:/ { total=$2 } /buffers\/cache/ { used=$3 } END { print used/total*100}'", $memarray); $memused = floor($memarray[0]); if ($memused > 90) { $memused_status = "danger"; } diff --git a/index.php b/index.php index 3eeb5289..e898f489 100755 --- a/index.php +++ b/index.php @@ -19,7 +19,11 @@ */ define('RASPI_CONFIG', '/etc/raspap'); -define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth'); +if(file_exists(RASPI_CONFIG.'/raspap.auth')) { + define('RASPI_ADMIN_DETAILS', RASPI_CONFIG.'/raspap.auth'); +} else { + define('RASPI_ADMIN_DETAILS',''); +} // Constants for configuration file paths. // These are typical for default RPi installs. Modify if needed. diff --git a/raspap.php b/raspap.php index 9f5430b0..3ec743da 100644 --- a/raspap.php +++ b/raspap.php @@ -5,10 +5,11 @@ $config = array( 'admin_pass' => '$2y$10$YKIyWAmnQLtiJAy6QgHQ.eCpY4m.HCEbiHaTgN6.acNC6bDElzt.i' ); -if ( $auth_details = fopen(RASPI_CONFIG.'/raspap.auth', 'r') ) { - $config['admin_user'] = trim(fgets($auth_details)); - $config['admin_pass'] = trim(fgets($auth_details)); - fclose($auth_details); +if(file_exists(RASPI_CONFIG.'/raspap.auth')) { + if ( $auth_details = fopen(RASPI_CONFIG.'/raspap.auth', 'r') ) { + $config['admin_user'] = trim(fgets($auth_details)); + $config['admin_pass'] = trim(fgets($auth_details)); + fclose($auth_details); + } } - ?>