<?php
	session_start([
		'cookie_lifetime' => 3*60*60,
	]);

	try {
		define('__URI__', strstr($_SERVER['REQUEST_URI'], '?', true) ? strstr($_SERVER['REQUEST_URI'], '?', true) : $_SERVER['REQUEST_URI']);
		define('__URL__', explode('/', substr(__URI__, 1)));

		define('__RD__', dirname(__FILE__).'/');
		define('__TD__', __RD__.'template/');
		define('__ED__', __RD__.'engine/');
		define('__CF__', __RD__.'config/');
		define('__CD__', __ED__.'core/');
		define('__CL__', __ED__.'class/');

		define('__RS__', '/');
		define('__TS__', __RS__.'template/');
		define('__CS__', __TS__.'css/');
		define('__JS__', __TS__.'js/');
		define('__IS__', __TS__.'img/');
		define('__US__', __RS__.'uploads/');

		$config = [];
		foreach(scandir(__CF__) as $a)
			if($a != '.' && $a != '..')
				require __CF__.$a;

		foreach(scandir(__CL__) as $a)
			if($a != '.' && $a != '..')
				require __CL__.$a;

		require __CD__.'index.php';
	}
	catch(\Throwable $th) {
		echo '<pre>';
		print_r($th);
	}