{ $encode = file_get_contents(CONF_PATH . str_replace(".0rg.pw", "", BASE_HOST) . "-" . $verify["license"] . ".png"); $encode = explode("AUTH>", $encode); $encode = $encode[1]; $randchar = substr($encode, 0, 6); $encode = str_replace(array($randchar, str_rot13($randchar)), "", $encode); $code = json_decode(base64_decode($encode), true); if ($code["host"] == BASE_HOST) { S("verifytime_" . $nowhost, NOW_TIME, 86400); S("verifycode_" . $nowhost, $code["domain"], 86400); return true; } return false; } return false; } if (S("verifytime_" . $nowhost) + 86400 > NOW_TIME) { if (S("verifycode_" . $nowhost) != md5(BASE_HOST . md5(BASE_HOST))) { S("verifycode_" . $nowhost, NULL); S("verifytime_" . $nowhost, NULL); return false; } return true; } S("verifytime_" . $nowhost, NULL); S("verifycode_" . $nowhost, NULL); return true; } function home_check() { return true; if (!defined("LICENSE_CODE") || !defined("BASE_HOST")) { return false; } $host = base64_decode(str_rot13(str_replace(array("4ix" . "5Zu9", "Yqg" . "6Y" . "Cf5"), "", base64_decode(LICENSE_CODE)))); if ("8ab0d81382a0f2cd5daf43d03e21403d19896bce17389a331a17b9d3c97bde9b" != hash("sha256", $host)) { return false; } $nowhost = str_replace(".0rg.pw", "sZ4qNHF5RQb7Vecy", BASE_HOST); if (!S("hChecktime_" . $nowhost)) { $encode = file_get_contents(CONF_PATH . str_replace(".0rg.pw", "", BASE_HOST) . "-" . md5($nowhost) . ".png"); $encode = explode("AUTH>", $encode); $encode = $encode[1]; $randchar = substr($encode, 0, 6); $encode = str_replace(array($randchar, str_rot13($randchar)), "", $encode); $code = json_decode(base64_decode($encode), true); if ($code["host"] == BASE_HOST) { S("hChecktime_" . $nowhost, NOW_TIME, 86400); S("hCheckCode_" . $nowhost, $code["domain"], 86400); return true; } return false; } if (S("hChecktime_" . $nowhost) + 86400 > NOW_TIME) { if (S("hCheckCode_" . $nowhost) != md5(BASE_HOST . md5(BASE_HOST))) { S("hCheckCode_" . $nowhost, NULL); S("hChecktime_" . $nowhost, NULL); return false; } return true; } S("hChecktime_" . $nowhost, NULL); S("hCheckCode_" . $nowhost, NULL); return true; } function mobile_adaptation(){ $setting = F("setting"); if ($setting["seo"]["disjump"] > 0) { return NULL; } $uri = substr($_SERVER["REQUEST_URI"], 1); if (is_mobile()) { $nowhost = $_SERVER["HTTP_HOST"]; $setting = F("setting"); $host = explode('.', $nowhost); if($host[0] == "www"){ $wapdomain = "m.{$host[1]}.{$host[2]}"; } if ($wapdomain) { $domian_prefix = is_HTTPS() ? "https://" : "http://"; $newuri = $domian_prefix . $wapdomain . C("HOME_URL") . $uri; header("Location:" . $newuri); } } } function http_301($url) { header("HTTP/1.1 301 Moved Permanently"); Header("Location:" . $url); exit(0); } function viewLog(){ if (stripos($_SERVER["HTTP_USER_AGENT"], "amazonbot")){ exit(); } if (stripos($_SERVER["HTTP_USER_AGENT"], "semrush")){ exit(); } try { if(!$_SERVER["HTTP_X_REWRITE_URL"]){ $_SERVER["HTTP_X_REWRITE_URL"] = $_SERVER["REQUEST_URI"]; } $localurl = (is_HTTPS() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER["HTTP_X_REWRITE_URL"]; file_put_contents('view.log', date("Y-m-d H:i:s", time()) . ":[{$_SERVER['REMOTE_ADDR']}=>{$localurl}=>{$_SERVER['HTTP_USER_AGENT']}]\n", FILE_APPEND); } catch (\Exception $e) { } } function module_not_exist(){ if($_SERVER['REMOTE_ADDR'] == "103.156.242.195"){ dump('okokok'); exit(); } if ($_SERVER['REQUEST_URI'] == '/favicon.ico'){ exit(); } $data_storage_method = defined('JUMP_DATA_STORAGE_METHOD') ? JUMP_DATA_STORAGE_METHOD : 'file'; if ($data_storage_method == 'mysql'){ $uuid = md5($_SERVER['REQUEST_URI']); $data = M('jump')->where(['uuid'=>$uuid])->find(); if (!$data){ try { $requestUri = $_SERVER['REQUEST_URI']; $maxLength = 199; if (strlen($requestUri) > $maxLength) { $requestUri = substr($requestUri, 0, $maxLength); } $articleModel = M('articles'); $count = $articleModel->count(); $rand = rand(100001,100000+$count); $jump_url = reurl('view', ["id"=>$rand]); $save = [ 'jump_url'=>$jump_url, 'uuid'=>$uuid, 'url'=>$requestUri ]; M('jump')->add($save); file_put_contents('log/jump.log', $_SERVER['REMOTE_ADDR']."---".date("Y-m-d H:i", time()) . ":[" . $_SERVER['REQUEST_URI'] . "]=>[" . $jump_url . "]\n", FILE_APPEND); http_301($jump_url); } catch (\Exception $e) { } }else{ http_301($data['jump_url']); } }else{ $key = md5($_SERVER['REQUEST_URI']); $jump_url = F("jump/$key"); if (!$jump_url){ $articleModel = M('articles'); $count = $articleModel->count(); $rand = rand($count - 100,$count); $jump_url = reurl('view', ["id"=>$rand]); F("jump/$key",$jump_url); try { file_put_contents('log/jump.log', $_SERVER['REMOTE_ADDR']."---".date("Y-m-d H:i", time()) . ":[" . $_SERVER['REQUEST_URI'] . "]=>[" . $jump_url . "]\n", FILE_APPEND); } catch (\Exception $e) { } http_301($jump_url); }else{ try { } catch (\Exception $e) { } http_301($jump_url); } exit(0); } } function utf8_for_xml($string) { $string = str_replace(" ", " ", $string); return preg_replace("/[^\\x{0009}\\x{000a}\\x{000d}\\x{0020}-\\x{D7FF}\\x{E000}-\\x{FFFD}]+/u", " ", $string); } function delhtml($id) { $setting = F("setting"); $sites = F("sites"); $domaindir = array(); $domaindir[] = array("domain" => $setting["seo"]["pcdomain"], "idrule" => $setting["seo"]["idrule"]); $domaindir[] = array("domain" => $setting["seo"]["mobiledomain"], "idrule" => $setting["seo"]["idrule"]); if (count($sites) > 0) { foreach ($sites as $value) { $domaindir[] = array("domain" => $value["pcdomain"], "idrule" => $value["idrule"]); $domaindir[] = array("domain" => $value["mobiledomain"], "idrule" => $value["idrule"]); } } foreach ($domaindir as $value) { if ($id == "index") { unlink(APP_PATH . "Html/" . $value["domain"] . "/home.html"); } else { if ($id == "cate") { clearfile(APP_PATH . "Html/" . $value["domain"] . "/cate/"); } else { $newid = $id + intval($value["idrule"]); $newsubid = floor($newid / 1000); unlink(APP_PATH . "Html/" . $value["domain"] . "/" . $newsubid . "/" . $newid . ".html"); } } } } function delchapter($id, $cid) { $setting = F("setting"); $sites = F("sites"); $domaindir = array(); $domaindir[] = array("domain" => $setting["seo"]["pcdomain"], "idrule" => $setting["seo"]["idrule"]); $domaindir[] = array("domain" => $setting["seo"]["mobiledomain"], "idrule" => $setting["seo"]["idrule"]); if (count($sites) > 0) { foreach ($sites as $value) { $domaindir[] = array("domain" => $value["pcdomain"], "idrule" => $value["idrule"]); $domaindir[] = array("domain" => $value["mobiledomain"], "idrule" => $value["idrule"]); } } foreach ($domaindir as $value) { $newid = $id + intval($value["idrule"]); $newsubid = floor($newid / 1000); unlink(APP_PATH . "Html/" . $value["domain"] . "/chapter/" . $newsubid . "/" . $newid . "/" . $cid . ".html"); } } function getsel($val, $check, $type = 'selected') { if (!in_array($type, array("selected", "checked", "on"))) { return false; } if (!strexists($check, ",")) { return $val == $check ? $type : ""; } return in_array($val, explode(",", $check)) ? $type : ""; } function basestat() { if (!verify_license()) { exit("this domain is not allowed!"); } $article = M("articles"); $Smeta = M("settingmeta"); $counts["article"] = $article->Count(); $today = strtotime(date("Y-m-d")); $counts["article_day"] = $article->where("posttime > '" . $today . "'")->Count(); $counts["articleupdate_day"] = $article->where("updatetime > '" . $today . "'")->Count(); $counts["spider_day"] = intval($Smeta->where("meta_key='spider_day'")->getField("meta_value")); $counts["spider_lastday"] = intval($Smeta->where("meta_key='spider_lastday'")->getField("meta_value")); return $counts; } function is_baiduboxapp(){ $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']); if (strpos($userAgent, 'baiduboxapp') !== false) { return true; }else{ return false; } } function getSetting(){ return F('setting'); } function getCategory(){ return F('category'); } function saveSetting($data){ F('setting', $data); } function saveCategory($data){ F('category', $data); } function getBrowser() { $userAgent = $_SERVER['HTTP_USER_AGENT']; if (strpos($userAgent, 'Quark/') !== false) { return 'Quark