summaryrefslogtreecommitdiff
path: root/swat/esptest/session.esp
blob: e1d6a6370d98052ee856c942c22b41f14308d2ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<HTML>
<TITLE>
Samba4 ESP test
</TITLE>
<BODY>
<h1>Samba4 session test</h1>

<form name="SessionTest" method="POST" action="@@request['SCRIPT_NAME']"> 
    Name:   <input name="Name"  type="text" value=""><br>
    Value:  <input name="Value" type="text" value=""><br>
    Timeout: <input name="Timeout" type="text" value=""><br>
    <input name="submit" type="submit" value="Append">
    <input name="submit" type="submit" value="Reset">
    <input name="submit" type="submit" value="Destroy">
    <input name="submit" type="submit" value="Cancel"><br>
</form>

<%
  /* if its a post then the user has filled in the form, so
     report the values 
  */
if (request['REQUEST_METHOD'] == "POST") {
	/* if they cancelled then take them back to the list of tests */
	if (form['submit'] == "Cancel") {
		redirect("index.esp");
	}
	
	name  = form['Name'];
	value = form['Value'];
	timeout = form['Timeout'];
	
	if (timeout) {
		useSession(timeout);
	}
	
	if (form['submit'] == "Reset" && name) {
		session[name] = null;
	}
	
	if (form['submit'] == "Append" && name) {
		session[name] = "" + session[name] + value;
	}
	
	if (form['submit'] == "Destroy") {
		destroySession();
	}
}

function showArray(name, array) {
	write("<h3>Array: " + name + "</h3>\n");
	if (array == undefined) {
		write("undefined<br>\n");
		return;
	}
	for (v in array) {
		write(name + "[" + v + "]=" + array[v] + "<br>\n");
	}
}

showArray("session", session);
write("SessionId=" + request['SESSION_ID'] + "<br>\n");
%>

</BODY>
</HTML>