<?php
// We need to use sessions, so you should always start sessions using the below code.
define('PHP_VESRION', phpversion());
date_default_timezone_set("Europe/Helsinki");

$GLOBALS['errors'] = array();

include_once("dbConnect.php");
include_once("includes/function_library.php");
if(version_compare('5.5.0', PHP_VESRION) >= 0) {
	include_once("password.php");
}

include_once("includes/email_handler.php");

include_once("includes/system_user.php");
$system_user = new system_user($_SESSION['id']);
$system_users = array();

if(isset($system_user->my_data['admin'])) {
	define('SITEADMIN', $system_user->my_data['admin']);
} else {
	define('SITEADMIN', false);
}

if($system_user->my_data['last_login'] == '0000-00-00 00:00:00' AND !strpos($_SERVER['REQUEST_URI'], 'profile')) {
	header('Location: index.php?profile');
	exit("Errors with first login");
}

define('LANG', $system_user->my_data['lang']);
if(file_exists('languages/'.$system_user->my_data['lang'].'.php')) {
	define('LANGUAGEFILE', 'languages/'.$system_user->my_data['lang'].'.php');
} else {
	define('LANGUAGEFILE', 'languages/swe.php');
}

include_once("includes/function_compatibility.php");
include_once("includes/interface_components.php");

?>