X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=libs%2Fluci-lib-nixio%2FaxTLS%2Fwww%2Flua%2Ftest_session.lua;fp=libs%2Fluci-lib-nixio%2FaxTLS%2Fwww%2Flua%2Ftest_session.lua;h=d97cc4520163967c415da719c9c508d00c9e0034;hb=1bb4822dca6113f73e3bc89e2acf15935e6f8e92;hp=0000000000000000000000000000000000000000;hpb=9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4;p=project%2Fluci.git diff --git a/libs/luci-lib-nixio/axTLS/www/lua/test_session.lua b/libs/luci-lib-nixio/axTLS/www/lua/test_session.lua new file mode 100644 index 000000000..d97cc4520 --- /dev/null +++ b/libs/luci-lib-nixio/axTLS/www/lua/test_session.lua @@ -0,0 +1,43 @@ +cgilua.enablesession () + +function pt (tab) + for i, v in pairs (tab) do + local vv = v + if type(v) == "table" then + vv = "" + for _i, _v in pairs (v) do + vv = vv..string.format ("%s = %q, ", _i, _v) + end + vv = '{'..vv..'}' + end + cgilua.put (string.format ("%s = %s
\n", tostring (i), tostring (vv))) + end +end + + +if cgi.field then + if not cgilua.session.data.field then + cgilua.session.data.field = {} + end + table.insert (cgilua.session.data.field, cgi.field) +end +cgilua.htmlheader() +if cgilua.session then + cgilua.put "cgi = {
\n" + pt (cgi) + cgilua.put "}
\n" + cgilua.put "cgilua.session.data = {
\n" + pt (cgilua.session.data) + cgilua.put "}
\n" + + cgilua.put [[
+ field:
+
+
]] +else + cgilua.put "Sessions library is not available or not well configured" +end