镜像来自
https://git.openwrt.org/project/luci.git
已同步 2025-01-18 23:45:02 +00:00
1bb4822dca
* Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
43 line
1,005 B
Lua
43 line
1,005 B
Lua
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<br>\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 = {<br>\n"
|
|
pt (cgi)
|
|
cgilua.put "}<br>\n"
|
|
cgilua.put "cgilua.session.data = {<br>\n"
|
|
pt (cgilua.session.data)
|
|
cgilua.put "}<br>\n"
|
|
|
|
cgilua.put [[<form action="]]
|
|
cgilua.put (cgilua.mkurlpath"test_session.lua")
|
|
cgilua.put [[" method="POST">
|
|
field: <input type="text" name="field" value="]]
|
|
cgilua.put (cgi.field or "")
|
|
cgilua.put [["><br>
|
|
<input type="submit"><br>
|
|
</form>]]
|
|
else
|
|
cgilua.put "Sessions library is not available or not well configured"
|
|
end
|