<?php
if (!defined('ISDVBBS') OR !defined('ROOT_PATH') OR !defined('INC_PATH')){
	header('HTTP/1.0 400 Bad Request');
	exit;
}
if (false) {
	$_arrtmp = array('.iboker.com.cn', '.iboker.net.cn', '.dvbbs.net');
	foreach ($_arrtmp AS $val) {
		if (false !== strpos($_SERVER['HTTP_HOST'], $val)) {
			define('MAIN_DOMAIN_NAME', $val);
		}
	}//end foreach
	!defined('MAIN_DOMAIN_NAME') AND exit('Access denied!');
	!($_str_pos = strpos($_SERVER['HTTP_HOST'], MAIN_DOMAIN_NAME)) AND exit('Access denied!');
	define('USER_DOMAIN_NAME', preg_replace('#^[^-0-9a-zA-Z_]+$#i', '', substr($_SERVER['HTTP_HOST'], 0, $_str_pos)));
	('' == USER_DOMAIN_NAME) AND exit('Access denied!');

	if (define('CACHE_PATH', ROOT_PATH.'cache/'.USER_DOMAIN_NAME.MAIN_DOMAIN_NAME.'/') AND !@is_dir(CACHE_PATH)) {
		header('Location: http://www'.MAIN_DOMAIN_NAME.'/error.php?errno=1&access_domain_name='.urlencode(USER_DOMAIN_NAME.MAIN_DOMAIN_NAME));
		exit(0);
	}

	define('CONFIG_PATH', CACHE_PATH);
	define('RELATED_CACHE_PATH', 'cache/'.USER_DOMAIN_NAME.MAIN_DOMAIN_NAME.'/');
	define('UPLOAD_BASEDIR', 'uploadfile/'.USER_DOMAIN_NAME.MAIN_DOMAIN_NAME.'/');
} else {
	define('USER_DOMAIN_NAME', '');
	define('CACHE_PATH', ROOT_PATH.'cache/');
	define('CONFIG_PATH', INC_PATH);
	define('RELATED_CACHE_PATH', 'cache/');
}
?>