> $logfile`; } else { echo "lol"; $s = trim(`tail -n 1 $logfile | cut -d" " -f 7-8`); if( "$addr $r" != "$s" ) { `echo \`date\` $addr $r >> $logfile`; } } } function info() { print "
".`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I`."\n";
	print "\n".`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s`."\n";
	print "\nto add network:\n";
	print "\t/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -A
"; } function art($q) { print << $q / () /(\ "*" |\ EOF; } $addr = $_SERVER['REMOTE_ADDR']; // if accessed from outside the network if( $addr != "127.0.0.1" ) { if( $logfile ) { logmsg($addr, $loglvl, $logfile); } art($addr); die; } // if query string $q = urldecode($_SERVER['QUERY_STRING']); if( $q ) { switch($q) { case "-v": print "
wireless homepage by 31d1 $vers
"; die; default: info(); die; } } // offline if( gethostbyname($host_test) == $host_test ) { header("Status: 302 Moved"); header("Location: $offline_page"); die; } // get networks $ssid = `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I | awk '/ SSID/ {printf $2}'`; $trusted_netwks = explode("\n", `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -S | awk '/\// {print $2}'`); // online if ($ssid && in_array($ssid, $trusted_netwks) ) { header("Status: 302 Moved"); header("Location: $home_page"); die; } elseif( $ssid ) { print "$ssid: online"; info(); } else { header("Status: 302 Moved"); header("Location: $home_page"); } ?>