Wireless LANs found:

'2.412', 2 => '2.417', 3 => '2.422', 4 => '2.427', 5 => '2.432', 6 => '2.437', 7 => '2.442', 8 => '2.447', 9 => '2.452', 10 => '2.457', 11 => '2.462', 12 => '2.467', 13 => '2.472', 14 => '2.484'); $raw_output = shell_exec('/usr/sbin/iwlist ath0 scan'); //echo "Raw:
$raw_output

\n"; /* Check if device driver is loaded */ if (strpos($raw_output,'No such device')) { $fail = 2; } /* check if output is "No scan results */ elseif (strpos($raw_output,'No scan results')) { $fail = 1; } else { $fail = 0; } // tests passed if ($fail == 0) { $data_array = explode("\n",$raw_output); $i=1; //ignore first line; it just says "Scan completed" //echo "Data row 1: ".ltrim($data_array[$i])."
\n"; while ($i\n"; $colon_char = strpos($data_array[$i],':'); switch (substr($data_array[$i],20,strpos($data_array[$i],':',20)-20)) { case 'Mode': $wlans[$numcells]['mode'] = substr($data_array[$i],$colon_char+1); break; case 'Encryption key': $wlans[$numcells]['encryptionkey'] = substr($data_array[$i],$colon_char+1); break; case 'ESSID': $wlans[$numcells]['essid'] = str_replace("\"","",substr($data_array[$i],$colon_char+1)); break; case 'Frequency': $wlans[$numcells]['frequency'] = substr($data_array[$i],$colon_char+1,5); break; case 'Bit Rate': $wlans[$numcells]['bitrate'] .= " " . str_replace("Mb/s","",substr($data_array[$i],$colon_char+1)); break; case 'Quality': $slash_char = strpos($data_array[$i],'/'); $wlans[$numcells]['quality'] = substr($data_array[$i],$colon_char+1,$slash_char-$colon_char-1); break; } // end of switch statement if (strpos($data_array[$i],'Cell')) // new network { $numcells++; $wlans[$numcells]['address'] = substr($data_array[$i],strpos($data_array[$i],":"+1)); } //echo "Network #".$cell_num. " - " . $wlans[$cell_num]['essid'] . // " - Address is ".$wlans[$cell_num]['address']. "
\n"; //echo "Mode is " .$wlans[$cell_num]['mode'].", Encryption key is ". // $wlans[$cell_num]['encryptionkey']. "
\n"; $i++; } // output the data $i=1; //array_multisort($wlans['quality'],sort_numeric); //echo "Found $numcells networks:
\n"; echo "\n"; echo "\n"; while ($i<=$numcells) { if ($wlans[$i]['quality']>=19) { $color="#00dd00"; } elseif ($wlans[$i]['quality']>=10) { $color="yellow"; } else { $color="red"; } // Set channel $channel = array_search($wlans[$i]['frequency'],$freqs); echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $i++; } echo "
ESSIDQualityModeChannelMax Speed (Mb/s)
" . $wlans[$i]['essid'] . "" . $wlans[$i]['quality'] . "" . $wlans[$i]['mode'] . "" . $channel . "" . substr($wlans[$i]['bitrate'],strrpos($wlans[$i]['bitrate'],' ')+1) . "
\n"; } else { echo "

Sorry, nothing found.

\n"; if ($fail==2) { echo "

Please check to ensure the Atheros driver has been loaded into the kernel.

\n"; } elseif ($fail==1) { echo "

Please check to ensure the wireless antenna switch is on.

\n"; } } ?>