Switch OFF register_globals!" ) ; } $connect = mysql_connect ( $dbase_host, $dbase_user, $dbase_pass ); $status = explode ( ' ', mysql_stat ( $connect ) ) ; $questions = explode ( " ", $status [ 2 ] ) ; $oldquestions = $questions [ 1 ] ; mysql_select_db ( $dbase_dbname, $connect ); mysql_query ( "SET NAMES cp1251", $connect ) ; if (substr ( $_SERVER [ 'HTTP_HOST' ], 0, 4 ) == "www.") { $this_domain = strtolower ( str_replace ( "www.", "", $_SERVER [ 'HTTP_HOST' ] ) ) ; } else { $this_domain = strtolower ( $_SERVER [ 'HTTP_HOST' ] ) ; } $coc = $this_domain ; $subdomains = array ( "www.", "test." ) ; $this_cat = array ( ) ; foreach ( $subdomains as $key => $value ) { $coc = str_replace ( $value, "", $coc ) ; if (strpos ( $_SERVER [ 'HTTP_HOST' ], $value ) === 0) { $this_cat [ substr ( $value, 0, - 1 ) ] = true ; } } $coc = "." . $coc ; header ( "Cookie: name=value; path=/; domain=." . $coc ) ; if (!isset($_GET['lang'])) { $query = mysql_query ( "SELECT `lang` FROM `langs` WHERE `default`='1'"); $find_default_lang = mysql_fetch_assoc($query); $DBSHOP_LANG = $find_default_lang['lang']; } elseif (isset($_GET['lang'])) { $DBSHOP_LANG = $_GET['lang']; }; include_once (dirname ( __FILE__ ) . "/../dbshop/api/functions.php") ; include_once (dirname ( __FILE__ ) . "/../dbshop/api/smtpmail.php") ; $query = mysql_query ( "SELECT s.url, s.name, s.title, s.description, s.keyword FROM shops AS s INNER JOIN langs ON langs.langid=s.langid WHERE (s.url = '" . (empty ( $this_cat ) ? $this_domain : substr ( $coc, 1 )) . "' AND langs.lang='".$DBSHOP_LANG."')" ) ; $shop = mysql_fetch_assoc($query); mysql_free_result ( $query ) ; $query = mysql_query ( "SELECT * FROM conf" ) ; while ($line = mysql_fetch_assoc ( $query )){ $globalSiteConf[$line['name']] = $line['value']; }; mysql_free_result ( $query ) ; if (!empty($shop)) { define("SITE_NAME", stripslashes($shop['name'])); define("DBSHOP_LURL", $this_domain); define("DBSHOP_URL", "http://".$shop['url']."/"); }; if ($globalSiteConf['mode']=='test' && strpos($_SERVER['HTTP_HOST'],$globalSiteConf['testsub'].'.')===FALSE){ header("HTTP/1.1 503 Service Temporarily Unavailable"); header("Status: 503 Service Temporarily Unavailable"); header("Retry-After: 86000"); header("X-Powered-By:"); $tpl = file_get_contents ( DBSHOP_PATH . "/dbshop/templates/working.tpl" ) ; echo $tpl; mysql_close ( $connect ) ; ob_end_flush(); exit(); }; $outs [ 'SITE_TITLE' ] = empty ( $shop [ 'title' ] ) ? SITE_NAME . " " : stripslashes ( $shop [ 'title' ] ) ; $outs [ 'SITE_NAME' ] = SITE_NAME ; $outs [ 'SITE_DESCR' ] = $shop [ 'description' ] ; $outs [ 'SITE_KEYWORDS' ] = $shop [ 'keyword' ] ; $pic = "/design/".$DBSHOP_LANG."/pix/gps_logo.gif" ; $outs [ 'SITE_LOGO' ] = '' . SITE_NAME . '' ; unset ( $pic ) ; $outs [ 'SITE_CENTER' ] = "" ; unset ( $shop, $this_domain, $path_data ) ; //Определение необходимого модуля if (! empty ( $_GET [ 'module' ] )) { if (eregi ( "^([a-zA-Z0-9])+$", $_GET [ 'module' ] )) { $cur_module = $_GET [ 'module' ] ; } else { $cur_module = "home" ; } } else { $cur_module = "home" ; } //Загружаем тексты модуля define ( "LANG_FILE", DBSHOP_PATH . "/dbshop/lang/". $DBSHOP_LANG ."/". $cur_module . ".xml" ) ; $lang = array ( ) ; if (file_exists ( LANG_FILE )) { $xmllang = simplexml_load_file ( LANG_FILE ) ; foreach ( $xmllang->values [ 0 ]->attributes () as $a => $b ) { $lang [ $a ] = ( string ) $b ; } } //Загрузка модуля define ( "MODULE_FILE", DBSHOP_PATH . "/dbshop/modules/" . $cur_module . ".php" ) ; if (file_exists ( MODULE_FILE )) { clearstatcache () ; require_once (MODULE_FILE) ; } else { require_once (DBSHOP_PATH . "/dbshop/modules/404.php") ; } //Загружаем и выводим шаблон if (! isset ( $usetpl )) { $usetpl = 1 ; } if ($usetpl) { $nonews = ($globalSiteConf['news']=='hide'?'_nonews':''); $tpl = file_get_contents ( DBSHOP_PATH . "/dbshop/templates/".$DBSHOP_LANG.$nonews.".tpl" ) ; function toarray ( $matches ) { global $outs ; if (eregi ( "^BLOCK_", $matches [ 1 ] )) { include (DBSHOP_PATH . "/dbshop/blocks/" . strtolower ( substr ( $matches [ 1 ], 6 ) ) . ".php") ; return $outs [ $matches [ 1 ] ] ; } else { return $outs [ $matches [ 1 ] ] ; } } echo preg_replace_callback ( "/{DBT:::(.*)}/", "toarray", $tpl ) ; } if (DEBUG == 1) { $time_end = microtime ( 1 ) ; $time = $time_end - $time_start ; unset ( $outs ) ; mysql_query ( "INSERT INTO temp (`ses`,`time`) VALUES ('" . $_SESSION [ 'SID' ] . "','" . time () . "')" ) ; mysql_query ( "DELETE FROM temp WHERE time < '" . (time () - 600) . "'" ) ; if ($usetpl) { $status = explode ( ' ', mysql_stat ( $connect ) ) ; $questions = explode ( " ", $status [ 2 ] ) ; $q = mysql_query ( "SELECT COUNT(ses) FROM temp" ) ; $users = mysql_result ( $q, 0 ) ; mysql_free_result ( $q ) ; echo "
" ; echo " Info: " ; echo " " . round ( $time, 4 ) . "sec  " ; echo " " . ($questions [ 1 ] - $oldquestions) . " queries  " ; echo " " . round ( memory_get_usage () / 1024, 2 ) . "(" . round ( memory_get_peak_usage () / 1024, 2 ) . ") Kb  " ; echo " " . $users . " users  " ; echo "
" ; unset ( $status, $questions, $oldquestions ) ; } }; mysql_close ( $connect ) ; ob_end_flush(); ?>