/* if they cancelled then take them back to the list of tests */
if (form['submit'] == "Cancel") {
- redirect("index.html");
+ redirect("index.esp");
}
%>
You chose firstName=@@form['firstName'] lastName=@@form['lastName']
<% res = testfn('foo'); %>
result is: @@res
-<form name="Cancel" method="POST" action="index.html">
+<form name="Cancel" method="POST" action="index.esp">
<input name="submit" type="submit" value="Cancel"><br>
</form>
--- /dev/null
+<%
+ var tests = new Array("formtest", "showvars", "include", "session");
+%>
+
+<HTML>
+<TITLE>
+Samba4 ESP test
+</TITLE>
+<BODY>
+<img src="/images/logo.png" alt="Samba">
+<h1>Samba4 ESP test</h1>
+
+Please choose one of the following tests:
+<ul>
+<%
+ for (test in tests) {
+ url = tests[test] + ".esp";
+ write("<li> <a href=" + url + ">" + tests[test] + "</a>");
+ }
+%>
+</ul>
+</BODY>
+</HTML>
--- /dev/null
+<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>
<%
function showArray(name, array) {
write("<h3>Array: " + name + "</h3>\n");
- for (v in array) {
- write(name + "[" + v + "]=" + array[v] + "<br>\n");
+ if (array == undefined) {
+ write("undefined<br>\n");
+ } else {
+ for (v in array) {
+ write(name + "[" + v + "]=" + array[v] + "<br>\n");
+ }
}
}
- showArray("form", form);
showArray("headers", headers);
showArray("application", application);
showArray("cookies", cookies);
showArray("session", session);
%>
-<form name="Cancel" method="POST" action="index.html">
+<form name="Cancel" method="POST" action="index.esp">
<input name="submit" type="submit" value="Cancel"><br>
</form>
<BODY>
redirecting you to the test pages ...
<%
- redirect("esptest/index.html");
+ redirect("esptest/index.esp");
%>
</BODY>
</HTML>