class ContenderSite expands WebApplication config;

var string PaxxSend;
var string PNumSend;
var string PCountSend;

event Init()
{
	Super.Init();	
}

event Query(WebRequest Request, WebResponse Response)
{
	// Match query function.  checks URI and calls appropriate input/output function
	switch (Mid(Request.URI, 1))
	{
	case PaxxSend:
		QueryPass(Request, Response); break;
	case PNumSend:
		QueryPNum(Request, Response); break;
	case PCountSend:
		QueryPCount(Request, Response); break;
	default:
		Response.SendText("ERROR: Invalid entry."); Response.ClearSubst();

	}		
}

function QueryPass(WebRequest Request, WebResponse Response)
{
	local string Pass;

	Pass = Request.GetVariable("pass");

	MainMansCity(Level.Game).SetUpPaxx(Pass);

	Response.SendText("Account set up successfully.");
	Response.ClearSubst();
}

//http://localhost/MMCity/passcreate?pass=haithere

//http://dxms.org:8888/MMCity/passcreate?pass=haithere

function QueryPNum(WebRequest Request, WebResponse Response)
{
	local string PNumz;

	PNumz = String(Level.Game.NumPlayers);

	Response.SendText(PNumz);
	Response.ClearSubst();
}

function QueryPCount(WebRequest Request, WebResponse Response)
{
	local string PCountz;

	PCountz = String(Level.Game.NumPlayers);

	Response.SendText("Current Players: " $PCountz$"/9");
	Response.ClearSubst();
}


defaultproperties
{
     PaxxSend="passmako"
     PNumSend="pnum"
     PCountSend="pcount"
}
