r9434: moved the registry editor into a common js library. Deryck, does this
[jra/samba/.git] / swat / esptest / session.esp
1 <% page_header("columns", "ESP session test", "esptest"); 
2    include("/scripting/forms.js");
3 %>
4
5 <h1>Samba4 session test</h1>
6
7 <%
8 var f = FormObj("SessionTest", 3, 4);
9 f.element[0].label = "Name";
10 f.element[1].label = "Value";
11 f.element[2].label = "Timeout";
12 f.submit[0] = "Append";
13 f.submit[1] = "Reset";
14 f.submit[2] = "Destroy";
15 f.submit[3] = "Cancel";
16
17 f.display();
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("/");
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 simple_table(session);
50 write("SessionId=" + request['SESSION_ID'] + "<br/>\n");
51 %>
52
53 <% page_footer(); %>