<html>
<!-- example session variable usage -->
<?lsp
print("<h2>session variables</h2>");
print("<pre>");
session = request:session() -- returns nil/false if there is no session
if session then
print("we have a session ", session)
session.counter = (session.counter or 0) + 1 --count session usage of this page
session:maxinactiveinterval(60);
print ("id", session:id());
print ("creationtime" ,os.date("%c",session:creationtime()))
print ("lastaccessedtime" ,os.date("%c",session:lastaccessedtime()))
print ("maxinactiveinterval" ,session:maxinactiveinterval())
print ("usecounter" ,session:usecounter())
-- if we have any attributes print them all
if session:attributes() then
table.foreach(session:attributes(), print)
end
end
print("</pre>")
?>
</html>
<!-- example session variable usage -->
<?lsp
print("<h2>session variables</h2>");
print("<pre>");
session = request:session() -- returns nil/false if there is no session
if session then
print("we have a session ", session)
session.counter = (session.counter or 0) + 1 --count session usage of this page
session:maxinactiveinterval(60);
print ("id", session:id());
print ("creationtime" ,os.date("%c",session:creationtime()))
print ("lastaccessedtime" ,os.date("%c",session:lastaccessedtime()))
print ("maxinactiveinterval" ,session:maxinactiveinterval())
print ("usecounter" ,session:usecounter())
-- if we have any attributes print them all
if session:attributes() then
table.foreach(session:attributes(), print)
end
end
print("</pre>")
?>
</html>