/Library/WebServer/Documents/genome_cooperative/status/ip_info.txt"; @exec($argument); $searchterm = array('googlebot', 'msnbot', 'crawl', 'spider', 'SideWinder', 'infoseek', 'robot', 'scoutjet', 'fastsearch', 'utel.net', '2dayhost'); // open ip_info.php to see result of command line command host search // put result of command line host search in variable $searched_pool, trim the carriage return $searched_pool=''; $fp1 = fopen("status/ip_info.txt", "r"); while(!feof($fp1)){ $curr_line = fgets($fp1, 100); $searched_pool = $curr_line.$searched_pool; $searched_pool = trim($searched_pool); } fclose($fp1); // determine if current response from command line command "host XXX.XXX.XXX.XXX" visitor-ip is found in robot's-IP list // && $searched_pool!='' refers to if there is no info in the ip_info.txt file if ($search_string!='' && $searched_pool!='') { for ($p=0;$p<=10; $p++) { $position=strpos($searched_pool, $searchterm[$p]); $array_of_position_results[$p]=$position; } if ($array_of_position_results[0]===false && $array_of_position_results[1]===false && $array_of_position_results[2]===false && $array_of_position_results[3]===false && $array_of_position_results[4]===false && $array_of_position_results[5]===false && $array_of_position_results[6]===false && $array_of_position_results[7]===false && $array_of_position_results[8]===false && $array_of_position_results[9]===false && $array_of_position_results[10]===false) { if (!isset($_SESSION['sess_pin'])) { // check if variable HTTP_REFERER is set for output in output_string if (isset($_SERVER['HTTP_REFERER'])) { $referer=$_SERVER['HTTP_REFERER'];} else {$referer='';} // read current number in counter, increase the counter, write the increased number back to file as the new counter number $fp2 = fopen("status/counter.txt", "r"); $count = fgets($fp2, 100); fclose($fp2); $newcount = $count + 1; $fp3 = fopen("status/counter.txt", "w"); fwrite($fp3, $newcount); fclose($fp3); // collect visitor info $fp4 = fopen("status/hit_info.txt", "r"); $date = date("m/d/Y"); $time = date("H:i:s"); $output_string = "$newcount;".$_SERVER['REMOTE_ADDR'].";"."$searched_pool".";".$referer.";".$_SERVER['REQUEST_URI'].";$date;$time\r\n"; // add info about current visitor to variable output_string while(!feof($fp4)){ $curr_line = fgets($fp4, 100); $output_string .= $curr_line; } fclose($fp4); // write new info to file hitinfo.txt $fp5 = fopen("status/hit_info.txt", "w"); fwrite($fp5, $output_string); fclose($fp5); } // if (!isset($_SESSION['sess_pin'])) } // if ($array_of_position_results[0]===false && ...$array_of_position_results[10]===false) } // if ($search_string!='' && $searched_pool!='') $_SESSION['sess_pin'] = "variableisset"; ?>