$value) { $j[] = str_replace('\r\n','',trim($value)); } $zong_juzi = count($j); $ju = array(); for ($i = 0; $i < $a; $i++) { $ju[$i] = $j[mt_rand(0,$zong_juzi - 1)]; } array_filter($ju); return $ju; } function rdomain( $d ) { $provace = array( ); return str_replace( "*", dechex( date( "s" ).mt_rand( 1111, 9999 ) ).$provace[rarray_rand( $provace )], $d ); } function rarray_rand( $arr ) { return mt_rand(0, count( $arr ) - 1); } function varray_rand( $arr ) { return $arr[rarray_rand($arr)]; } function get_folder_files($folder) { $fp = opendir($folder); while(false!= $file = readdir($fp) ) { if($file!='.' &&$file!='..') { $file="$file"; $arr_file[]=$file; } } closedir($fp); return $arr_file; } $timeout = 2592000; require DIR . '/config1018.php'; include DIR . "/jimmoo.com/dirCache.class.php"; $cache = new dirCache(); $mydomain =$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]; //$mainDomain = preg_replace('/^(www\.)?([^\/]+).*$/', '$2', $mydomain); //$keyForCache = $mainDomain.$_SERVER["REQUEST_URI"]; // 基于关键词组合的哈希缓存系统 // 1. 先基于URL生成固定的关键词组合 $urlHash = md5($mydomain); // 2. 使用哈希的不同段来固定选择核心元素 $keywordIndex = hexdec(substr($urlHash, 0, 8)) % count($keyword_list); $variableIndex = hexdec(substr($urlHash, 8, 8)) % count($dtk2_list); $videoIndex = hexdec(substr($urlHash, 16, 8)) % count(file(DIR."/jimmoo.com/shipin/shipin.txt")); // 3. 获取固定的核心元素 $fixedKeywordFile = $keyword_list[$keywordIndex]; $fixedVariableFile = $dtk2_list[$variableIndex]; $fixedVideoContent = trim(file(DIR."/jimmoo.com/shipin/shipin.txt")[$videoIndex]); // 4. 基于这3个核心元素生成组合哈希作为缓存键 $coreElements = $fixedKeywordFile . '|' . $fixedVariableFile . '|' . $fixedVideoContent; $combinedHash = md5($coreElements); $cacheKey = $mydomain . '_' . substr($combinedHash, 0, 16); // 使用前16位哈希 if ($cache->isExists($cacheKey, $timeout)) { $moban = $cache->get($cacheKey); // 只处理真正动态的内容(每次访问都变化的) $zf1 = count(explode('<将蒙_动态随机字符>', $moban)) - 1; for ($ii=0; $ii<$zf1; $ii++) { $moban = preg_replace('/<将蒙_动态随机字符>/', randKey(5), $moban, 1); } $ri5 = count(explode('<将蒙_动态随机数字>', $moban)) - 1; for ($i=0; $i<$ri5; $i++) { $moban = preg_replace('/<将蒙_动态随机数字>/', mt_rand(10000, 99999), $moban, 1); } $moban = str_replace( "<将蒙_动态当天时间>", date( "Y-m-d" ), $moban ); // 动态随机关键词(每次都变) $ci = count(explode('<将蒙_动态随机关键词>', $moban)) - 1; if ($ci!=0) { $keywords = file( DIR."/jimmoo.com/keywords1018/" . varray_rand( $keyword_list ) ); for ($ii=0; $ii<$ci; $ii++) { $moban = preg_replace('/<将蒙_动态随机关键词>/', trim(varray_rand($keywords)), $moban, 1); } } // 动态句子(每次都变) $wk = count(explode('<将蒙_动态句子>', $moban)) - 1; if ($wk!=0) { $juzi = file( DIR."/jimmoo.com/juzi/" . varray_rand( $wenku_list ) ); for ($wi=0; $wi<$wk; $wi++) { $moban = preg_replace('/<将蒙_动态句子>/', trim(varray_rand($juzi)), $moban, 1); } } $wk = count(explode('<将蒙_动态句子2>', $moban)) - 1; if ($wk!=0) { $juzi2 = file( DIR."/jimmoo.com/juzi2/" . varray_rand( $wenku_list2 ) ); for ($wi=0; $wi<$wk; $wi++) { $moban = preg_replace('/<将蒙_动态句子2>/', trim(varray_rand($juzi2)), $moban, 1); } } // 动态spider内容 $spider = file( DIR."/jimmoo.com/spider/" . varray_rand( $spider_link ) ); $wk = count(explode('', $moban)) - 1; for ($wi=0; $wi<$wk; $wi++) { $moban = preg_replace('//', trim(varray_rand($spider)), $moban, 1); } $moban = preg_replace('//', '', $moban, 1); echo $moban; exit(); } $template1_list = get_folder_files(DIR . '/jimmoo.com/templates/neirong2/'); // 使用之前固定选择的核心元素 $keywords = $bak_keywords = file( DIR."/jimmoo.com/keywords1018/" . $fixedKeywordFile ); // 重新设计哈希分段策略,避免重复使用 // 使用不同的哈希组合来选择句子文件 $juziFileHash = hexdec(substr($urlHash, 24, 6)); // 使用24-29位 $juziFileIndex = $juziFileHash % count($wenku_list); $juzi = $bak_juzi = file( DIR."/jimmoo.com/juzi/" . $wenku_list[$juziFileIndex] ); $juzi2FileHash = hexdec(substr($urlHash, 30, 2)) + hexdec(substr($urlHash, 0, 4)); // 使用组合哈希 $juzi2FileIndex = $juzi2FileHash % count($wenku_list2); $juzi2 = $bak_juzi2 = file( DIR."/jimmoo.com/juzi2/" . $wenku_list2[$juzi2FileIndex] ); $spider = $bak_spider = file( DIR."/jimmoo.com/spider/" . varray_rand( $spider_link ) ); $domains = file( DIR."/jimmoo.com/domains/domains.txt" ); $duankous = file( DIR."/jimmoo.com/duankou/duankous.txt" ); $shipins = file( DIR."/jimmoo.com/shipin/shipin.txt" ); // 获取模板内容 $moban = file_get_contents(DIR."/jimmoo.com/templates/neirong2/". varray_rand( $template1_list ) ); // 固定视频内容替换 $shipin = count(explode('<将蒙_随机视频>', $moban)) - 1; for ($sp=0; $sp<$shipin; $sp++) { $videoHash = hexdec(substr($urlHash, 16 + ($sp * 2), 4)) % count($shipins); $moban = preg_replace('/<将蒙_随机视频>/', trim($shipins[$videoHash]), $moban, 1); } // 基于URL哈希固定选择主关键词和其他关键词 $keywordHash = hexdec(substr($urlHash, 0, 8)); $gjc1 = trim($keywords[$keywordHash % count($keywords)]); // 主关键词 $gjc2 = trim($keywords[($keywordHash + 1) % count($keywords)]); $gjc3 = trim($keywords[($keywordHash + 2) % count($keywords)]); $gjc4 = trim($keywords[($keywordHash + 3) % count($keywords)]); $gjc5 = trim($keywords[($keywordHash + 4) % count($keywords)]); $gjc6 = trim($keywords[($keywordHash + 5) % count($keywords)]); $gjc7=trim(varray_rand($keywords)); $moban = str_replace( "<将蒙_主关键词>", $gjc1, $moban ); $moban = str_replace( "<将蒙_关键词2>", $gjc2, $moban ); $moban = str_replace( "<将蒙_关键词3>", $gjc3, $moban ); $moban = str_replace( "<将蒙_关键词4>", $gjc4, $moban ); $moban = str_replace( "<将蒙_关键词5>", $gjc5, $moban ); $moban = str_replace( "<将蒙_关键词6>", $gjc6, $moban ); $moban = str_replace( "<将蒙_关键词7>", $gjc7, $moban ); function getdomain($url) { $host = strtolower ( $url ); if (strpos ( $host, '/' ) !== false) { $parse = @parse_url ( $host ); $host = $parse ['host']; } $topleveldomaindb = array ('gov.cn', 'com.cn', 'net.cn', 'org.cn', 'com', 'cn', 'asia', 'edu', 'gov', 'ga', 'net', 'org', 'biz', 'info', 'pw', 'name', 'mobi', 'cc', 'hk' ); $str = ''; foreach ( $topleveldomaindb as $v ) { $str .= ($str ? '|' : '') . $v; } $matchstr = "[^\.]+\.(?:(" . $str . ")|\w{2}|((" . $str . ")\.\w{2}))$"; if (preg_match ( "/" . $matchstr . "/ies", $host, $matchs )) { $domain = $matchs ['0']; } else { $domain = $host; } return $domain; } $duankou=$_SERVER["SERVER_PORT"]; $url1=$_SERVER['REQUEST_URI']; $yuming=$_SERVER['HTTP_HOST']; $yuming=str_replace(':'.$duankou, '', $yuming); $yumi=getdomain ( $yuming ); $url2=str_replace('.'.$yumi, '', $yuming); // 使用更科学的哈希分布选择随机关键词 $ci = count(explode('<将蒙_随机关键词>', $moban)) - 1; for ($ii=0; $ii<$ci; $ii++) { // 使用不同的哈希段组合,避免与主关键词重复 $keywordHash = hexdec(substr($urlHash, (4 + $ii * 3) % 32, 4)) + hexdec(substr($urlHash, (20 + $ii) % 32, 2)); $keywordIndex = $keywordHash % count($keywords); $moban = preg_replace('/<将蒙_随机关键词>/', trim($keywords[$keywordIndex]), $moban, 1); } // 使用独立的哈希段选择句子内容 $wk = count(explode('<将蒙_句子>', $moban)) - 1; for ($wi=0; $wi<$wk; $wi++) { // 使用与句子文件选择不同的哈希段 $juziHash = hexdec(substr($urlHash, (12 + $wi * 4) % 32, 4)) + hexdec(substr($urlHash, (28 + $wi) % 32, 2)); $juziIndex = $juziHash % count($juzi); $moban = preg_replace('/<将蒙_句子>/', trim($juzi[$juziIndex]), $moban, 1); } // 使用独立的哈希段选择句子2内容 $wk2 = count(explode('<将蒙_句子2>', $moban)) - 1; for ($wi2=0; $wi2<$wk2; $wi2++) { // 使用与其他标签不同的哈希组合 $juzi2Hash = hexdec(substr($urlHash, (6 + $wi2 * 3) % 32, 4)) + hexdec(substr($urlHash, (26 + $wi2 * 2) % 32, 3)); $juzi2Index = $juzi2Hash % count($juzi2); $moban = preg_replace('/<将蒙_句子2>/', trim($juzi2[$juzi2Index]), $moban, 1); } // 使用独立的哈希段选择端口 $dk = count(explode('<将蒙_随机端口>', $moban)) - 1; for ($di=0; $di<$dk; $di++) { // 使用与其他标签不同的哈希段 $duankouHash = hexdec(substr($urlHash, (10 + $di * 5) % 32, 3)) + hexdec(substr($urlHash, (18 + $di * 2) % 32, 2)); $duankouIndex = $duankouHash % count($duankous); $moban = preg_replace('/<将蒙_随机端口>/', trim($duankous[$duankouIndex]), $moban, 1); } // 使用独立的哈希段选择内链 $vi = count( explode( "<将蒙_随机内链>", $moban ) ) - 1; for ($li=0; $li<$vi; $li++) { // 使用与其他标签不同的哈希组合 $domainHash = hexdec(substr($urlHash, (14 + $li * 4) % 32, 3)) + hexdec(substr($urlHash, (22 + $li * 3) % 32, 2)); $domainIndex = $domainHash % count($domains); $s = trim($domains[$domainIndex]); $moban = preg_replace('/<将蒙_随机内链>/', $s, $moban, 1); } // 使用独立的哈希段生成随机字符 $zf1 = count(explode('<将蒙_随机字符>', $moban)) - 1; for ($ii=0; $ii<$zf1; $ii++) { // 使用与其他标签不同的哈希组合 $charHash = hexdec(substr($urlHash, (2 + $ii * 6) % 32, 3)) + hexdec(substr($urlHash, (16 + $ii * 2) % 32, 2)); $fixedChars = 'abcdefghijklmnopqrstuvwxyz0123456789'; $fixedStr = ''; for ($j=0; $j<5; $j++) { $fixedStr .= $fixedChars[($charHash + $j * 7) % strlen($fixedChars)]; // 增加随机性 } $moban = preg_replace('/<将蒙_随机字符>/', $fixedStr, $moban, 1); } // 使用独立的哈希段生成随机数字 $ri5 = count(explode('<将蒙_随机数字>', $moban)) - 1; for ($i=0; $i<$ri5; $i++) { // 使用与其他标签不同的哈希组合 $numHash = hexdec(substr($urlHash, (8 + $i * 7) % 32, 4)) + hexdec(substr($urlHash, (20 + $i * 3) % 32, 2)); $fixedNum = 100 + ($numHash % 900); // 100-999范围 $moban = preg_replace('/<将蒙_随机数字>/', $fixedNum, $moban, 1); } $moban = str_replace( "<将蒙_当前域名>", $yuming, $moban ); $moban = str_replace( "<将蒙_顶级域名>", $yumi, $moban ); $moban = str_replace( "<将蒙_当前域名1>", $_SERVER['HTTP_HOST'], $moban ); // 基于URL哈希固定选择图片 $tupian5 = count(explode('<将蒙_随机图片>', $moban)) - 1; for ($tui=0; $tui<$tupian5; $tui++) { $imageHash = hexdec(substr($urlHash, ($tui * 4 + 12) % 32, 4)); $imageIndex = $imageHash % count($image_list); $moban = preg_replace('/<将蒙_随机图片>/', '/images/' . $image_list[$imageIndex], $moban, 1); } // 基于URL哈希固定选择外链文件和内容 $dtk1Hash = hexdec(substr($urlHash, 4, 8)); $dtk1FileIndex = $dtk1Hash % count($dtk1_list); $dtk1s = file(DIR . "/jimmoo.com/wailian/" . $dtk1_list[$dtk1FileIndex]); $ci = count(explode('<外链>', $moban)) - 1; if ($ci != 0) { for ($ii = 0; $ii < $ci; $ii++) { $dtk1ContentHash = hexdec(substr($urlHash, (12 + $ii * 4) % 32, 4)); $dtk1ContentIndex = $dtk1ContentHash % count($dtk1s); $moban = preg_replace('/<外链>/', trim($dtk1s[$dtk1ContentIndex]), $moban, 1); } } // 使用固定的变量文件 $dtk2s = file(DIR . "/jimmoo.com/bianliang/" . $fixedVariableFile); $ci = count(explode('<将蒙_变量>', $moban)) - 1; if ($ci != 0) { $variableHash = hexdec(substr($urlHash, 24, 8)); for ($ii = 0; $ii < $ci; $ii++) { $varIndex = ($variableHash + $ii) % count($dtk2s); $moban = preg_replace('/<将蒙_变量>/', trim($dtk2s[$varIndex]), $moban, 1); } } // 基于URL哈希固定选择人名文件和内容 $dtk3Hash = hexdec(substr($urlHash, 20, 8)); $dtk3FileIndex = $dtk3Hash % count($dtk3_list); $dtk3s = file(DIR . "/jimmoo.com/renming/" . $dtk3_list[$dtk3FileIndex]); $ci = count(explode('<将蒙_人名>', $moban)) - 1; if ($ci != 0) { for ($ii = 0; $ii < $ci; $ii++) { $dtk3ContentHash = hexdec(substr($urlHash, (28 + $ii * 2) % 32, 4)); $dtk3ContentIndex = $dtk3ContentHash % count($dtk3s); $moban = preg_replace('/<将蒙_人名>/', trim($dtk3s[$dtk3ContentIndex]), $moban, 1); } } $moban = str_replace( "<将蒙_年>", date( "y" ), $moban ); $moban = str_replace( "<将蒙_年月日>", date( "Ymd" ), $moban ); $moban = str_replace( "<将蒙_发布时间>", date( "Y-m-d H:i:s" ), $moban ); $moban = str_replace( "<将蒙_发布时间1>", date( "m-d",strtotime("-1 day")), $moban ); $moban = str_replace( "<将蒙_发布时间2>", date( "m-d",strtotime("-2 day")), $moban ); $moban = str_replace( "<将蒙_发布时间3>", date( "m-d",strtotime("-3 day")), $moban ); $moban = str_replace( "<将蒙_发布时间4>", date( "m-d",strtotime("-4 day")), $moban ); $moban = str_replace( "<将蒙_发布时间5>", date( "m-d",strtotime("-5 day")), $moban ); $moban = str_replace( "<将蒙_发布时间6>", date( "m-d",strtotime("-6 day")), $moban ); $moban = str_replace( "<将蒙_发布时间7>", date( "m-d",strtotime("-7 day")), $moban ); $moban = str_replace( "<将蒙_发布时间8>", date( "m-d",strtotime("-8 day")), $moban ); $moban = str_replace( "<将蒙_发布时间9>", date( "m-d",strtotime("-9 day")), $moban ); $moban = str_replace( "<将蒙_发布时间10>", date( "m-d",strtotime("-10 day")), $moban ); $moban = str_replace( "<将蒙_发布时间11>", date( "m-d",strtotime("-11 day")), $moban ); $moban = str_replace( "<将蒙_发布时间12>", date( "m-d",strtotime("-12 day")), $moban ); $moban = str_replace( "<将蒙_发布时间13>", date( "m-d",strtotime("-13 day")), $moban ); $moban = str_replace( "<将蒙_发布时间14>", date( "m-d",strtotime("-14 day")), $moban ); $moban = str_replace( "<将蒙_发布时间15>", date( "m-d",strtotime("-15 day")), $moban ); $moban = str_replace( "<将蒙_发布时间16>", date( "m-d",strtotime("-16 day")), $moban ); $moban = str_replace( "<将蒙_发布时间17>", date( "m-d",strtotime("-17 day")), $moban ); $moban = str_replace( "<将蒙_发布时间18>", date( "m-d",strtotime("-18 day")), $moban ); $moban = str_replace( "<将蒙_发布时间19>", date( "m-d",strtotime("-19 day")), $moban ); $moban = str_replace( "<将蒙_发布时间20>", date( "m-d",strtotime("-20 day")), $moban ); $moban = str_ireplace( "", "", $moban ); if(stripos($key,'Spider') == false && stripos($key,'bot') == false) { $zhizhu="jia"; } else { $zhizhu="zhen"; } // 使用组合哈希键进行缓存 if($baiduspider !== false) { $cache->set( $cacheKey, $moban ); } else { if($zhizhu == "jia") { $cache->set( $cacheKey, $moban ); } } $zf1 = count(explode('<将蒙_动态随机字符>', $moban)) - 1; for ($ii=0; $ii<$zf1; $ii++) { $moban = preg_replace('/<将蒙_动态随机字符>/', randKey(5), $moban, 1); } $ri5 = count(explode('<将蒙_动态随机数字>', $moban)) - 1; for ($i=0; $i<$ri5; $i++) { $moban = preg_replace('/<将蒙_动态随机数字>/', mt_rand(10000, 99999), $moban, 1); } $moban = str_replace( "<将蒙_动态当天时间>", date( "Y-m-d H:i:s" ), $moban ); $ci = count(explode('<将蒙_动态随机关键词>', $moban)) - 1; if ($ci!=0) { $keywords = $bak_keywords = file( DIR."/jimmoo.com/keywords1018/" . varray_rand( $keyword_list ) ); for ($ii=0; $ii<$ci; $ii++) { $moban = preg_replace('/<将蒙_动态随机关键词>/', trim(varray_rand($keywords)), $moban, 1); } } $wk = count(explode('<将蒙_动态句子>', $moban)) - 1; if ($wk!=0) { $juzi = $bak_juzi = file( DIR."/jimmoo.com/juzi/" . varray_rand( $wenku_list ) ); for ($wi=0; $wi<$wk; $wi++) { $moban = preg_replace('/<将蒙_动态句子>/', trim(varray_rand($juzi)), $moban, 1); } } $wk = count(explode('<将蒙_动态句子2>', $moban)) - 1; if ($wk!=0) { $juzi2 = $bak_juzi2 = file( DIR."/jimmoo.com/juzi2/" . varray_rand( $wenku_list2 ) ); for ($wi=0; $wi<$wk; $wi++) { $moban = preg_replace('/<将蒙_动态句子2>/', trim(varray_rand($juzi2)), $moban, 1); } } $wk = count(explode('', $moban)) - 1; for ($wi=0; $wi<$wk; $wi++) { $moban = preg_replace('//', trim(varray_rand($spider)), $moban, 1); } $moban = preg_replace('//', '', $moban, 1); echo $moban; function nowtime() { $date=date("Y-m-d.G:i:s"); return $date; } ; ; ?>