home *** CD-ROM | disk | FTP | other *** search
/ Game Level Design / GLDesign.bin / Software / UnrealEngine2Runtime / UE2Runtime-22262001_Demo.exe / UWeb / Classes / HelloWeb.uc next >
Text File  |  2003-10-22  |  2KB  |  60 lines

  1. class HelloWeb extends WebApplication;
  2.  
  3. /* Usage:
  4. This is a sample web application, to demonstrate how to program for the web server.
  5.  
  6.  
  7. [UWeb.WebServer]
  8. Applications[0]="UWeb.HelloWeb"
  9. ApplicationPaths[0]="/hello"
  10. bEnabled=True
  11.  
  12. http://server.ip.address/hello
  13.  
  14. */
  15.  
  16. event Query(WebRequest Request, WebResponse Response)
  17. {
  18.     local int i;
  19.  
  20.     if(Request.Username != "test" || Request.Password != "test")
  21.     {
  22.         Response.FailAuthentication("HelloWeb");
  23.         return;
  24.     }        
  25.  
  26.     switch(Request.URI)
  27.     {
  28.     case "/form.html":
  29.         Response.SendText("<form method=post action=submit.html>");
  30.         Response.SendText("<input type=edit name=TestEdit>");
  31.         Response.SendText("<p><select multiple name=selecter>");
  32.         Response.SendText("<option value=\"one\">Number One");
  33.         Response.SendText("<option value=\"two\">Number Two");
  34.         Response.SendText("<option value=\"three\">Number Three");
  35.         Response.SendText("<option value=\"four\">Number Four");
  36.         Response.SendText("</select><p>");
  37.         Response.SendText("<input type=submit name=Submit value=Submit>");
  38.         Response.SendText("</form>");
  39.         break;
  40.     case "/submit.html":
  41.         Response.SendText("Thanks for submitting the form.<br>");
  42.         Response.SendText("TestEdit was \""$Request.GetVariable("TestEdit")$"\"<p>");
  43.         Response.SendText("You selected these items:<br>");
  44.         for(i=Request.GetVariableCount("selecter")-1;i>=0;i--)
  45.             Response.SendText("\""$Request.GetVariableNumber("selecter", i)$"\"<br>");
  46.         break;
  47.     case "/include.html":
  48.         Response.Subst("variable1", "This is variable 1");
  49.         Response.Subst("variable2", "This is variable 2");
  50.         Response.Subst("variable3", "This is variable 3");
  51.         Response.IncludeUHTM("testinclude.html");
  52.         break;
  53.     default:        
  54.         Response.SendText("Hello web!  The current level is "$Level.Title);
  55.         Response.SendText("<br>Click <a href=\"form.html\">this link</a> to go to a test form");
  56.         break;
  57.     }
  58. }
  59.  
  60.