<?php

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_RPG);
init_userprefs($userdata);
//
// End session management
//

//
// Start of program proper
//
if ( isset($HTTP_GET_VARS['action']) || isset($HTTP_POST_VARS['action']) )
{
	$mode = ( isset($HTTP_GET_VARS['action']) ) ? $HTTP_GET_VARS['action'] : $HTTP_POST_VARS['action'];

	if ( $mode == 'menu' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=menu", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/menu.'.$phpEx);
		exit;
	}

	if ( $mode == 'extra' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=extra", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/extra.'.$phpEx);
		exit;
	}

	if ( $mode == 'position' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=position", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/position.'.$phpEx);
		exit;
	}

	if ( $mode == 'items' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=items", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/items.'.$phpEx);
		exit;
	}

	if ( $mode == 'weapons' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=weapons", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/weapons.'.$phpEx);
		exit;
	}

	if ( $mode == 'magic' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=magic", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/magic.'.$phpEx);
		exit;
	}

	if ( $mode == 'hospital' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=hospital", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/hospital.'.$phpEx);
		exit;
	}

	if ( $mode == 'joinjobs' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=joinjobs", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/joinjobs.'.$phpEx);
		exit;
	}

	if ( $mode == 'dice' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=dice", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/dice.'.$phpEx);
		exit;
	}

	if ( $mode == 'race' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=race", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/race.'.$phpEx);
		exit;
	}

	if ( $mode == 'gamble' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=gamble", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/gamble.'.$phpEx);
		exit;
	}

	if ( $mode == 'bank' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=bank", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/bank.'.$phpEx);
		exit;
	}

	if ( $mode == 'rob' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=rob", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/rob.'.$phpEx);
		exit;
	}

	if ( $mode == 'richer' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=richer", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/richer.'.$phpEx);
		exit;
	}

	if ( $mode == 'eol' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=eol", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/eol.'.$phpEx);
		exit;
	}

	if ( $mode == 'stat' )
	{
		if ( !$userdata['session_logged_in'] )
		{
			$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
			header($header_location . append_sid("login.$phpEx?redirect=rpg.$phpEx&action=stat", true));
			exit;
		}
		include($phpbb_root_path . 'rpg/stat.'.$phpEx);
		exit;
	}

}
else
{
	$header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
	header($header_location . append_sid("index.$phpEx", true));
	exit;
}

?>