<?
if (isset($_COOKIE["UID"]) && !empty($_COOKIE["UID"]) && (substr_count($_SERVER['HTTP_REFERER'],'lastworlds.ru/game.php')>0 || substr_count($_SERVER['HTTP_REFERER'],'lastworlds.ru/main.php')>0 || substr_count($_SERVER['HTTP_REFERER'],'lastworlds.ru/msg.php')>0)):
	
	require ($_SERVER['DOCUMENT_ROOT']."/maintenance/vars.php");
	require (ROOT.'/maintenance/dbconn.php');
	require (ROOT.'/maintenance/vcode.php');
	require (ROOT.'/maintenance/functions.php');
	require (ROOT.'/kernel/core.php');
	if (is_array($_REQUEST)):
		require (ROOT.'/kernel/system.php');
	endif;
	
	$pers = user(UID);
	if (!is_array($pers)): header ("location: /quit.php");
	else:
		require (ROOT."/maintenance/hp_restore.php");
		require (ROOT."/modules/top.php");
		if ($pers["cfight"]<>'' && $pers["cfight"]<>0):
			$pers["cpage"] = 'fight';
		endif;
		switch ($pers["cpage"]):
			case 'pers': require (ROOT."/modules/character.php"); break;
			case 'inv': require (ROOT."/modules/inventory.php"); break;
			case 'store': require (ROOT."/locations/store.php"); break;
			case 'arena': require (ROOT."/locations/arena.php"); break;
			case 'fight': require (ROOT."/modules/fight.php"); break;
		endswitch;
	endif;
	
else: 
header ("location: /quit.php");
endif;
?>
</body></html>