<?PHP
/*	index.php for GetPEN
	This is the file that always gets called.  It includes a command processor and then a display outputter.
	In TopBar.inc.php, there is code to include a file head/head$newby.html in the <head> section.
	*/
	$bugsy="";
	include (".htfolder.inc.php");

	$newby=intval($_SESSION["newby"])+1;
	if (array_key_exists("nuby",$_REQUEST)) $newby=intval($_REQUEST["nuby"]);	while (!array_key_exists($newby,$toc))
	{
		$newby++;
		$bugsy.="Upgraded newby to $newby.<br/>";
		if ($newby > 99)
		{
			header("Location: .");
			admin_notify("Page limit exceeded","$domain went past its available pages at ".$_SERVER["SCRIPT_FILENAME"]);
			die("It's finished.");
		}
	}

	##++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	COMMAND
	$command="cmd$newby.cmd";
	loggywoggy("Looking to do $command.");
	if (file_exists("command/$command")) include ("command/$command");

	##++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	DISPLAY
	$display="center$newby.inc.html";
	loggywoggy("Looking to display $display.");
	include ("display/TopBar.inc.html");		#The whole head section and the start of the body
	include ("display/$display");				#The central portion where things actually happen
	include ("display/BottomBar.inc.html");		#Copyright and other notices and the closing tags.

	$_SESSION["newby"]=$newby;
?>