r7093: - added a new Form() ejs object for producing simple forms.
[samba.git] / swat / esptest / session.esp
1 <% page_header("columns", "ESP session test"); %>
2
3 <h1>Samba4 session test</h1>
4
5 <form name="SessionTest" method="POST" action="@@request['SCRIPT_NAME']"> 
6     Name:   <input name="Name"  type="text" value=""><br>
7     Value:  <input name="Value" type="text" value=""><br>
8     Timeout: <input name="Timeout" type="text" value=""><br>
9     <input name="submit" type="submit" value="Append">
10     <input name="submit" type="submit" value="Reset">
11     <input name="submit" type="submit" value="Destroy">
12     <input name="submit" type="submit" value="Cancel"><br>
13 </form>
14
15 <%
16   /* if its a post then the user has filled in the form, so
17      report the values 
18   */
19 if (request['REQUEST_METHOD'] == "POST") {
20         /* if they cancelled then take them back to the list of tests */
21         if (form['submit'] == "Cancel") {
22                 redirect("/");
23         }
24         
25         name  = form['Name'];
26         value = form['Value'];
27         timeout = form['Timeout'];
28         
29         if (timeout) {
30                 useSession(timeout);
31         }
32         
33         if (form['submit'] == "Reset" && name) {
34                 session[name] = null;
35         }
36         
37         if (form['submit'] == "Append" && name) {
38                 session[name] = "" + session[name] + value;
39         }
40         
41         if (form['submit'] == "Destroy") {
42                 destroySession();
43         }
44 }
45
46 simple_table(session);
47 write("SessionId=" + request['SESSION_ID'] + "<br>\n");
48 %>
49
50 <% page_footer(); %>