Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UWeb.HelloWeb


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
class HelloWeb extends WebApplication;

/* Usage:
This is a sample web application, to demonstrate how to program for the web server.


[UWeb.WebServer]
Applications[0]="UWeb.HelloWeb"
ApplicationPaths[0]="/hello"
bEnabled=True

http://server.ip.address/hello

*/

event Query(WebRequest Request, WebResponse Response)
{
	local int i;

	if(Request.Username != "test" || Request.Password != "test")
	{
		Response.FailAuthentication("HelloWeb");
		return;
	}		

	switch(Request.URI)
	{
	case "/form.html":
		Response.SendText("<form method=post action=submit.html>");
		Response.SendText("<input type=edit name=TestEdit>");
		Response.SendText("<p><select multiple name=selecter>");
		Response.SendText("<option value=\"one\">Number One");
		Response.SendText("<option value=\"two\">Number Two");
		Response.SendText("<option value=\"three\">Number Three");
		Response.SendText("<option value=\"four\">Number Four");
		Response.SendText("</select><p>");
		Response.SendText("<input type=submit name=Submit value=Submit>");
		Response.SendText("</form>");
		break;
	case "/submit.html":
		Response.SendText("Thanks for submitting the form.<br>");
		Response.SendText("TestEdit was \""$Request.GetVariable("TestEdit")$"\"<p>");
		Response.SendText("You selected these items:<br>");
		for(i=Request.GetVariableCount("selecter")-1;i>=0;i--)
			Response.SendText("\""$Request.GetVariableNumber("selecter", i)$"\"<br>");
		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 "$Level.Title);
		Response.SendText("<br>Click <a href=\"form.html\">this link</a> to go to a test form");
		break;
	}
}

defaultproperties
{
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: pr 5-2-2018 12:35:50.000 - Creation time: sk 18-3-2018 09:50:10.833 - Created with UnCodeX