r6999: - renamed our html files to esp
[samba.git] / swat / esptest / session.esp
1 <HTML>
2 <TITLE>
3 Samba4 ESP test
4 </TITLE>
5 <BODY>
6 <h1>Samba4 session test</h1>
7
8 <form name="SessionTest" method="POST" action="@@request['SCRIPT_NAME']"> 
9     Name:   <input name="Name"  type="text" value=""><br>
10     Value:  <input name="Value" type="text" value=""><br>
11     Timeout: <input name="Timeout" type="text" value=""><br>
12     <input name="submit" type="submit" value="Append">
13     <input name="submit" type="submit" value="Reset">
14     <input name="submit" type="submit" value="Destroy">
15     <input name="submit" type="submit" value="Cancel"><br>
16 </form>
17
18 <%
19   /* if its a post then the user has filled in the form, so
20      report the values 
21   */
22 if (request['REQUEST_METHOD'] == "POST") {
23         /* if they cancelled then take them back to the list of tests */
24         if (form['submit'] == "Cancel") {
25                 redirect("index.esp");
26         }
27         
28         name  = form['Name'];
29         value = form['Value'];
30         timeout = form['Timeout'];
31         
32         if (timeout) {
33                 useSession(timeout);
34         }
35         
36         if (form['submit'] == "Reset" && name) {
37                 session[name] = null;
38         }
39         
40         if (form['submit'] == "Append" && name) {
41                 session[name] = "" + session[name] + value;
42         }
43         
44         if (form['submit'] == "Destroy") {
45                 destroySession();
46         }
47 }
48
49 function showArray(name, array) {
50         write("<h3>Array: " + name + "</h3>\n");
51         if (array == undefined) {
52                 write("undefined<br>\n");
53                 return;
54         }
55         for (v in array) {
56                 write(name + "[" + v + "]=" + array[v] + "<br>\n");
57         }
58 }
59
60 showArray("session", session);
61 write("SessionId=" + request['SESSION_ID'] + "<br>\n");
62 %>
63
64 </BODY>
65 </HTML>