<?php 


/** 
***************************************************
*欢迎使用免费版SiteTeam企业建站软件！
*这是一个专业为搜索引擎营销而设计的，极稳定、极易维护的建站软件！
*官方客服：help@php.net.cn
*官方下载网址：http://www.SiteTeam.cn 
***************************************************
**/




 define('SITE_ROOT', str_replace('\\', '/', substr(dirname(__FILE__), 0, -8))); if (function_exists('date_default_timezone_set')) { date_default_timezone_set('Asia/Chongqing'); } if ($_SERVER['SERVER_PORT'] != 80 || !isset($_SERVER['HTTP_HOST'])) { echo "本软件只能运行在HTTP80端口模式下！"; exit(); } if (!ini_get('short_open_tag')) { echo "你的PHP.INI文件需要启用“short_open_tag”选项才能运行本软件"; exit(); } if (!function_exists('file_get_contents')) { echo "你的PHP版本过低，不能运行该软件"; exit(); } @set_time_limit(0); $charset = 'GBK'; require_once SITE_ROOT . "/include/domain.php"; require_once SITE_ROOT . "/include/global.inc.php"; require_once SITE_ROOT . "/include/global.class.php"; if (!INSTALL_STATUS) { go_url("setup.php", "你还没有安装本建站程序，请先执行安装"); } $site_root = SITE_ROOT; $site_path = SITE_PATH; define("IN_SITETEAM", true); $site_url = $site_name = $_SERVER['HTTP_HOST']; if (!isset($cache_time)) $cache_time = 600; if ($cache_time > 86400) $cache_time = 86400; define("CACHE_TIME", $cache_time); define('ALLOW_URL_FOPEN', ini_get('allow_url_fopen')); if (!array_key_exists($site_url, $domain)) { $site_url = "www.{$site_url}"; if (!array_key_exists($site_url, $domain)) { echo "<b>你当前网站只绑定了以下域名，请使用下列域名访问你的网站：</b><br /><br />"; foreach ($domain as $k => $v) { echo "<a href='http://{$k}/" . SITE_PATH . "'>{$k}</a><br />"; } echo "<br />如果你想使用自己新域名访问网站，则请在网站的配置文件“./include/domain.php”文件中绑定你的新域名！"; exit(); } header("HTTP/1.1 301 Moved Permanently"); header("Location: http://{$site_url}{$_SERVER['REQUEST_URI']}"); exit(); } $temp = $domain[$site_url]; unset($domain); $domain[$site_url] = $temp; unset($temp); $config = $domain[$site_url]; unset($config['password']); extract($config); if (!empty($new_domain)) { $page_url = "http://{$new_domain}{$_SERVER['REQUEST_URI']}"; $page_url = url_rewrite($page_url, 'url'); header("HTTP/1.1 301 Moved Permanently"); header("Location:{$page_url}"); exit(); } $tpldir = SITE_ROOT . "/templates/{$skinid}"; $GETS = $GET = empty($_SERVER['QUERY_STRING']) ? "" : $_SERVER['QUERY_STRING']; if (!empty($GET)) { $GET = preg_replace("/[\/]+/", "/", $GET); $GET = preg_replace("/[\/]?$/", "", $GET); $GET = preg_replace("/^[\/]?/", "", $GET); $GET = preg_replace("/\.html$/", "", $GET); if (preg_match('/^[\w]+-[\w\-_\.]+/', $GET)) { $GET = explode("-", $GET); $mod = $GET[0]; unset($GET[0]); $page_url = "http://{$site_url}/?{$mod}/" . str_replace(array("-", "_"), "/", implode("/", $GET)) . ".html"; $page_url = url_rewrite($page_url, 'url'); header("HTTP/1.1 301 Moved Permanently"); header("Location:{$page_url}"); exit(); } $GETS = $GET = explode('/', $GET); $mod = $GETS[0]; $tmp = array(); unset($GET[0]); if (count($GET) > 0) { for ($i = 1; $i <= count($GET); $i = $i + 2) { $key = $GET[$i]; $value = array_key_exists(($i + 1), $GET) ? $GET[($i + 1)] : ""; $tmp[$key] = $value; } $GET = $tmp; unset($temp,$tmp); } else { $GET = array(); } } else { $GETS = $GET = array(); $mod = ""; } $siteteam = new XTEA("PoweredBy:http://www.siteteam.cn"); $siteteam_code = '$ad_logo = false; $ad_win = false; if (ALLOW_URL_FOPEN && CACHE_TIME > 0) { if (!file_exists($ad_status)) { if ($fp = @fopen($ad_status, "w")) { fwrite($fp, "4"); fclose($fp); $ad_logo = false; } else { $ad_logo = true; } } else { if (@is_writable($ad_status) && @is_readable($ad_status)) { if (time() - abs(filemtime($ad_status)) > 86400) { $link_server = false; $key = md5(time() . rand(00000, 99999)); $server_api1 = base64_decode("aHR0cDovL3d3dy5jaGVuaHVjaGVuZy5jb20=") . "/soft/ad.php?key={$key}&domain=" . base64_encode($site_url); $server_api2 = base64_decode("aHR0cDovL2RhdGEuc2l0ZXRlYW0uY24=") . "/soft/ad.php?key={$key}&domain=" . base64_encode($site_url); if ($fp = @fopen($server_api1, "r")) { $link_server = true; } elseif ($fp = @fopen($server_api2, "r")) { $link_server = true; } else { $link_server = false; } if ($link_server) { $ad_code = ""; while (!feof($fp)) { $ad_code .= fread($fp, 256); } if (!empty($ad_code)) { $ad_code = authcode($ad_code, "DECODE", $key); $ad_code = intval($siteteam->decrypt($ad_code)); if (!in_array($ad_code, array(4, 8, 3, 83))) { $ad_code = 8; } } else { $ad_code = 8; } fclose($fp); } else { $ad_code = 8; } $fp = fopen($ad_status, "w"); fwrite($fp, $ad_code); fclose($fp); if ($ad_code == 4) { $ad_logo = false; $ad_win = false; } elseif ($ad_code == 8) { $ad_logo = true; $ad_win = false; } elseif ($ad_code == 3) { $ad_logo = false; $ad_win = true; } elseif ($ad_code == 83) { $ad_logo = true; $ad_win = true; } else { $ad_logo = true; $ad_win = false; } } else { $ad_code = @intval(@file_get_contents($ad_status)); if (in_array($ad_code, array(4, 8, 3, 83))) { if ($ad_code == 4) { $ad_logo = false; $ad_win = false; } elseif ($ad_code == 8) { $ad_logo = true; $ad_win = false; } elseif ($ad_code == 3) { $ad_logo = false; $ad_win = true; } elseif ($ad_code == 83) { $ad_logo = true; $ad_win = true; } else { $ad_logo = true; $ad_win = false; } } else { $ad_logo = true; } } } else { $ad_logo = true; } } } else { $ad_logo = true; } '; $webspider = ''; if (isset($_SERVER['HTTP_USER_AGENT'])) { if (preg_match('/Baiduspider/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "BaiduSpider"; } elseif (preg_match('/Googlebot/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "GoogleBot"; } elseif (preg_match('/360Spider/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "360Spider"; } elseif (preg_match('/Sogou web spider/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "SogouSpider"; } elseif (preg_match('/msnbot/i', $_SERVER['HTTP_USER_AGENT'])) { $webspider = "MSNbot"; } if (!empty($webspider)) { $fp = gzopen(SITE_ROOT ."/data/log/webspider" . date("Ymd", time()) . ".gz", "a9"); $webspider = "{$webspider}\t\tIP:{$_SERVER['REMOTE_ADDR']}\t\tHOST:{$_SERVER['HTTP_HOST']}\t\tPAGE:{$_SERVER['REQUEST_URI']}\t\tTIME:" . time() . "\r\n"; gzwrite($fp, $webspider, strlen($webspider)); gzclose($fp); } } if (isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER'])) { $referer = $_SERVER['HTTP_REFERER']; $parse_url = parse_url($referer); $pathinfo = pathinfo($referer); if (isset($parse_url['query'])) { parse_str($parse_url['query'], $URL_QUERY); } else { $URL_QUERY = null; } $search_engine = ''; $referer_host = isset($parse_url['host']) ? $parse_url['host'] : ""; if (!empty($referer_host) && is_array($URL_QUERY)) { $referer_host = strtolower($referer_host); if (preg_match('/baidu\.com/i', $referer_host)) { $search_words = !empty($URL_QUERY['wd']) ? rawurldecode($URL_QUERY['wd']) : rawurldecode($URL_QUERY['word']); $search_engine = 'baidu'; } elseif (preg_match('/google\.com/i', $referer_host)) { $search_words = iconv("UTF-8", "gbk", rawurldecode($URL_QUERY['q'])); $search_engine = 'google'; } elseif (preg_match('/so\.com/i', $referer_host) && $referer_host != 'www.soso.com') { $search_words = iconv("UTF-8", "gbk", rawurldecode($URL_QUERY['q'])); $search_engine = '360SO'; } elseif (preg_match('/sogou\.com/i', $referer_host)) { $search_words = rawurldecode($URL_QUERY['query']); $search_engine = 'sogou'; } else { $search_words = ''; } if ($search_words != '') { $fp = gzopen(SITE_ROOT ."/data/log/words" . date("Ymd", time()) . ".gz", "a9"); gzwrite($fp, "IP:" . $_SERVER['REMOTE_ADDR'] . "\t\tEngine:" . $search_engine . "\t\tWords:" . $search_words . "\t\tTime:". date("Y-m-d H:i:s", time()) . "\r\n"); gzclose($fp); define("SEARCH_ENGINE", $search_engine); define("SEARCH_WORDS", $search_words); define("IN_CACHE", false); } } } if (!defined('IN_CACHE')) { define('IN_CACHE', true); } if (isset($_COOKIE['IS_ADMIN']) && $_COOKIE['IS_ADMIN'] == '1') { define('IS_ADMIN', true); } else { define('IS_ADMIN', false); } ?>