<?php

/* Datenbank-Verbindung herstellen */
$db = new mysqli (DB_HOST, DB_USER, DB_PASS, DB_NAME);
$db->set_charset('utf8');

/* Sprachdateien einbinden */
if (!isset ($_SESSION['sess_loginLang']) || empty ($_SESSION['sess_loginLang']))
{
	include_once(PATH_LANG . 'lang_' . $vC['portal']['languages'][0] . '.php');
	if (isset ($vC['portal']['address']) && file_exists(PATH_LANG . $vC['portal']['address'] . '/lang_' . $vC['portal']['languages'][0] . '.php'))
	{
		include_once(PATH_LANG . $vC['portal']['address'] . '/lang_' . $vC['portal']['languages'][0] . '.php');
	}
}
else
{
	if (file_exists(PATH_LANG . 'lang_' . $_SESSION['sess_loginLang'] . '.php'))
	{
		include_once(PATH_LANG . 'lang_' . $_SESSION['sess_loginLang'] . '.php');
		if (isset ($vC['portal']['address']) && file_exists(PATH_LANG . $vC['portal']['address'] . '/lang_' . $_SESSION['sess_loginLang'] . '.php'))
		{
			include_once(PATH_LANG . $vC['portal']['address'] . '/lang_' . $_SESSION['sess_loginLang'] . '.php');
		}
	}
	else
	{
		include_once(PATH_LANG . 'lang_' . $vC['portal']['languages'][0] . '.php');
		if (isset ($vC['portal']['address']) && file_exists(PATH_LANG . $vC['portal']['address'] . '/lang_' . $vC['portal']['languages'][0] . '.php'))
		{
			include_once(PATH_LANG . $vC['portal']['address'] . '/lang_' . $vC['portal']['languages'][0] . '.php');
		}
	}
}