<?php
$root_path = ".{$phpbb_root_path}";
$split = explode('.', $_SERVER['HTTP_HOST']);
if($split[0] == "http://" OR $split[0] == "www" OR $split[0] == "
http://www")
{
$subdomain = $split[1];
$domain = $split[2].".".$split[3];
}
else {
$subdomain = $split[0];
$domain = $split[1].".".$split[2];
}
$subdomain = str_replace('-', '_', $subdomain);
$subdomain = mysql_escape_string($subdomain);
if(is_dir($phpbb_root_path.'/configs/') and is_file($phpbb_root_path.'/configs/'.$subdomain.'.php'))
{
require_once($phpbb_root_path.'/configs/'.$subdomain.'.php');
}
else
{
require_once($root_path.'/includes/config.php');
require_once($root_path.'/includes/functions/database.php');
$database = new database();
$root_connection = $database->connect($host, $database_name, $user, $password);
//Abfrage ob vorhanden oder nicht
$sql = $database->query("SELECT COUNT(domain) as domain FROM `hosting_forums` WHERE `domain` = '".$subdomain."';", $root_connection);
$row = mysql_fetch_assoc($sql);
$row_d = $row['domain'];
$sql = $database->query("SELECT config_value FROM `hosting_config` WHERE `config_name` = 'site_title';", $root_connection);
$row1 = mysql_fetch_assoc($sql);
$main_domain = $row1['config_value'];
if($row_d == 0)
{
header("Location:
http://www.
exit;
}
//Rest
$database_id = mysql_fetch_array($database->query("SELECT `database_id` FROM `hosting_forums` WHERE `domain` = '{$subdomain}';", $root_connection));
$database_info = mysql_fetch_array($database->query("SELECT * FROM `hosting_database` WHERE `database_id` = '{$database_id['database_id']}';", $root_connection));
unset($database_id);
// phpBB 3.0.x auto-generated configuration file
// Do not change anything in this file!
$dbms = "mysql";
$dbhost = "{$database_info['server']}";
$dbport = "";
$dbname = "{$database_info['database']}";
$dbuser = "{$database_info['user']}";
$dbpasswd = "{$database_info['password']}";
$table_prefix = "{$subdomain}_";
$acm_type = "file";
$load_extensions = "";
@define("PHPBB_INSTALLED", true);
// @define("DEBUG", true);
// @define("DEBUG_EXTRA", true);
$content = '<?php
// phpBB 3.0.x auto-generated configuration file
// Do not change anything in this file!
$dbms = "mysql";
$dbhost = "'.$database_info['server'].'";
$dbport = "";
$dbname = "'.$database_info['database'].'";
$dbuser = "'.$database_info['user'].'";
$dbpasswd = "'.$database_info['password'].'";
$table_prefix = "'.$subdomain.'_";
$acm_type = "file";
$load_extensions = "";
@define("PHPBB_INSTALLED", true);
// @define("DEBUG", true);
// @define("DEBUG_EXTRA", true);
?>';
unset($database_info);
file_put_contents('./configs/'.$subdomain.'.php', $content);
}
?>