/*============================================================================= HelloWeb.uc - example web server Copyright 1998-2013 Epic Games, Inc. All Rights Reserved. =============================================================================*/ class HelloWeb extends WebApplication; /* Usage: This is a sample web application, to demonstrate how to program for the web server. [IpDrv.WebServer] Applications[0]="IpDrv.HelloWeb" ApplicationPaths[0]="/hello" bEnabled=True http://server.ip.address/hello */ function Init() { `log("HelloWeb INIT"); } event Query(WebRequest Request, WebResponse Response) { local int i; `log("Query received"@Request@Response); if(Request.Username != "test" || Request.Password != "test") { Response.FailAuthentication("HelloWeb"); return; } switch(Request.URI) { case "/form.html": Response.SendText("
"); Response.SendText(""); Response.SendText("

"); Response.SendText(""); Response.SendText("

"); break; case "/submit.html": Response.SendText("Thanks for submitting the form.
"); Response.SendText("TestEdit was \""$Request.GetVariable("TestEdit")$"\"

"); Response.SendText("You selected these items:
"); for(i=Request.GetVariableCount("selecter")-1;i>=0;i--) Response.SendText("\""$Request.GetVariableNumber("selecter", i)$"\"
"); break; case "/include.html": Response.Subst("variable1", "This is variable 1"); Response.Subst("variable2", "This is variable 2"); Response.Subst("variable3", "This is variable 3"); Response.IncludeUHTM("testinclude.html"); break; default: Response.SendText("Hello web! The current level is "$WorldInfo.Title); Response.SendText("
Click this link to go to a test form"); break; } } defaultproperties { }