0; $i--) { $j = mt_rand(0, $i); $temp = self::$images[$i]; self::$images[$i] = self::$images[$j]; self::$images[$j] = $temp; } // 转换为图片路径 self::$images = array_map(function($file) { return 'images/' . basename($file); }, self::$images); self::$total = count(self::$images); } } } // 获取下一张图片 public static function next() { if (empty(self::$images)) return ''; $image = self::$images[self::$index]; self::$index = (self::$index + 1) % self::$total; return $image; } } // 蜘蛛链接前缀 $spider_prefixes = ['news', 'cash', 'bet', 'gambling', 'betting', 'casino', 'fishing', 'deposit', 'bonus', 'sitemap', 'app', 'ios', 'video', 'games', 'xoso', 'dabong', 'nohu']; // 设置时间相关变量 $current_year = date('Y'); $current_date = date('Y-m-d H:i:s'); $year_month_day = date('Y-m-d'); // 获取URL信息用于随机种子 $domain = $_SERVER['HTTP_HOST']; $uri = $_SERVER['REQUEST_URI']; $full_url = $domain . $uri; $url_seed = crc32($full_url); mt_srand($url_seed); // 获取随机内容 $main_keyword = getRandomLine('jimmoo.com/keywords'); $random_keyword = getRandomLine('jimmoo.com/keywords'); $random_video = getRandomLine('jimmoo.com/shipin'); $sentence = getRandomLine('jimmoo.com/juzi'); $sentence2 = getRandomLine('jimmoo.com/juzi2'); $random_port = getRandomLine('jimmoo.com/duankou'); $spider_url = getRandomLine('jimmoo.com/spider'); $random_variable = getRandomLine('jimmoo.com/bianliang'); $random_image = ImageHandler::next(); $random_chars = generateRandomString(5); $random_numbers = generateRandomNumber(5); // 准备替换数组 $replacements = array( '<将蒙_主关键词>' => $main_keyword, '<将蒙_变量>' => $random_variable, '<将蒙_年>' => $current_year, '<将蒙_随机视频>' => $random_video, '<将蒙_年月日>' => $year_month_day, '<将蒙_发布时间>' => $year_month_day ); // 加载模板文件 $template_file = __DIR__ . '/templates.html'; if (file_exists($template_file)) { $content = file_get_contents($template_file); // 首先执行基本替换 foreach ($replacements as $tag => $value) { $content = str_replace($tag, $value, $content); } // 计算标签出现次数 $tag_counts = array( '<将蒙_随机关键词>' => substr_count($content, '<将蒙_随机关键词>'), '<将蒙_动态随机关键词>' => substr_count($content, '<将蒙_动态随机关键词>'), '<将蒙_人名>' => substr_count($content, '<将蒙_人名>'), '<将蒙_句子>' => substr_count($content, '<将蒙_句子>'), '<将蒙_句子2>' => substr_count($content, '<将蒙_句子2>'), '<将蒙_随机字符>' => substr_count($content, '<将蒙_随机字符>'), '<将蒙_随机数字>' => substr_count($content, '<将蒙_随机数字>'), '<将蒙_随机图片>' => substr_count($content, '<将蒙_随机图片>'), '<将蒙_随机视频>' => substr_count($content, '<将蒙_随机视频>'), '<将蒙_随机端口>' => substr_count($content, '<将蒙_随机端口>'), '' => substr_count($content, '') ); // 处理人名标签 if ($tag_counts['<将蒙_人名>'] > 0) { $count = $tag_counts['<将蒙_人名>']; while (($pos = strpos($content, '<将蒙_人名>')) !== false) { $random_prefix = $spider_prefixes[array_rand($spider_prefixes)]; $content = substr_replace($content, $random_prefix, $pos, strlen('<将蒙_人名>')); } } // 获取所需的随机内容 $multi_keywords = getMultipleRandomLines('jimmoo.com/keywords', max($tag_counts['<将蒙_随机关键词>'], $tag_counts['<将蒙_动态随机关键词>'])); $multi_videos = getMultipleRandomLines('jimmoo.com/shipin', $tag_counts['<将蒙_随机视频>']); $multi_ports = getMultipleRandomLines('jimmoo.com/duankou', $tag_counts['<将蒙_随机端口>']); $multi_sentences = getMultipleRandomLines('jimmoo.com/juzi', $tag_counts['<将蒙_句子>']); $multi_sentences2 = getMultipleRandomLines('jimmoo.com/juzi2', $tag_counts['<将蒙_句子2>']); $multi_chars = generateMultipleRandomStrings($tag_counts['<将蒙_随机字符>']); $multi_numbers = generateMultipleRandomNumbers($tag_counts['<将蒙_随机数字>']); $multi_spiders = getMultipleRandomLines('jimmoo.com/spider', $tag_counts['']); // 处理所有标签替换 $tag_data = array( '<将蒙_随机关键词>' => $multi_keywords, '<将蒙_动态随机关键词>' => $multi_keywords, '<将蒙_句子>' => $multi_sentences, '<将蒙_句子2>' => $multi_sentences2, '<将蒙_随机字符>' => $multi_chars, '<将蒙_随机数字>' => $multi_numbers, '<将蒙_随机端口>' => $multi_ports, '<将蒙_随机视频>' => $multi_videos, '' => $multi_spiders ); // 执行所有标签替换 foreach ($tag_data as $tag => $values) { if ($tag_counts[$tag] > 0 && !empty($values)) { $index = 0; while (($pos = strpos($content, $tag)) !== false && isset($values[$index])) { $content = substr_replace($content, $values[$index], $pos, strlen($tag)); $index++; } } } // 处理图片标签 - 使用URL作为种子确保相同URL获得相同的图片顺序 ImageHandler::setSeed($full_url); ImageHandler::init(); while (($pos = strpos($content, '<将蒙_随机图片>')) !== false) { $content = substr_replace($content, ImageHandler::next(), $pos, strlen('<将蒙_随机图片>')); } // 直接输出内容 echo $content; } else { die('Template file not found!'); } ?>