/* show a menu for the esp test pages */
simple_menu(
"ESP Tests",
- "ldb database", "/esptest/ldb.esp",
- "html forms", "/esptest/formtest.esp",
- "esp includes", "/esptest/include.esp",
- "session variables", "/esptest/session.esp",
- "loadparm access", "/esptest/loadparm.esp",
- "exception handling", "/esptest/exception.esp",
- "environment variables", "/esptest/showvars.esp");
+ "ldb database", session_uri("/esptest/ldb.esp"),
+ "html forms", session_uri("/esptest/formtest.esp"),
+ "esp includes", session_uri("/esptest/include.esp"),
+ "session variables", session_uri("/esptest/session.esp"),
+ "loadparm access", session_uri("/esptest/loadparm.esp"),
+ "exception handling", session_uri("/esptest/exception.esp"),
+ "environment variables", session_uri("/esptest/showvars.esp"));
<%
var f = Form("login", 2, 1);
f.element[0].label = "Username";
+f.element[0].value = form['Username'];
f.element[1].label = "Password";
+f.element[1].value = form['Password'];
f.element[1].type = "password";
f.submit[0] = "Login";
redirect them to the current page, which will now
show its true content */
if (request.REQUEST_URI == "/login.esp") {
- redirect("/");
+ redirect(session_uri("/"));
} else {
- redirect(request.REQUEST_URI);
+ redirect(session_uri(request.REQUEST_URI));
}
}
%>
/* fill in some defaults */
global.page.title = "Samba Web Administration Tool";
+/* to cope with browsers that don't support cookies we append the sessionid
+ to the URI */
+global.SESSIONURI = "";
+if (request['COOKIE_SUPPORT'] != "True") {
+ global.SESSIONURI="?SwatSessionId=" + request['SESSION_ID'];
+}
+
+/*
+ possibly adjust a local URI to have the session id appended
+ used for browsers that don't support cookies
+*/
+function session_uri(uri) {
+ return uri + global.SESSIONURI;
+}
+
+
/* if the browser was too dumb to set the HOST header, then
set it now */
include("/scripting/footer_" + global.page.pagetype + ".esp");
}
+
/*
check if a uri is one of the 'always allowed' pages, even when not logged in
This allows the login page to use the same style sheets and images
var allowed = new Array("/images/favicon.ico",
"/images/linkpad.gif",
"/images/logo.png",
+ "/images/logo.gif",
"/style/main.css",
"/style/common.css");
for (i in allowed) {
f.name = name;
f.element = new Array(num_elements);
f.submit = new Array(num_submits);
- f.action = request.REQUEST_URI;
+ f.action = session_uri(request.REQUEST_URI);
f.class = "form";
for (i in f.element) {
f.element[i] = new Object();
}
write("</form>\n");
}
+
<div class="stripe"></div>
<div class="logout">
<b>logged in as @@session.authinfo.username</b>
- <form method="post" action="/logout.esp">
+ <form method="post" action="/logout.esp@@global.SESSIONURI">
<input type="submit" value="Logout" />
</form>
</div>
</div>
<div id="logo">
- <div class="logo_hack"><a href="/"><img src="/images/linkpad.gif" alt="SWAT" /></a></div>
+ <div class="logo_hack"><a href="/@@global.SESSIONURI"><img src="/images/linkpad.gif" alt="SWAT" /></a></div>
</div>
<div class="slogan">