summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/ffluci-splash/src/luci-splash
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-04-27 16:12:24 +0000
committerSteven Barth <steven@midlink.org>2008-04-27 16:12:24 +0000
commitbba585f063ccc1e483346c9b5625d4dcf84d6586 (patch)
treeab369d260f321d1529a15c0a36b60e7e465fe8ae /contrib/package/ffluci-splash/src/luci-splash
parent1b159023db95ec0d429f1fc71536ef96edc37333 (diff)
* Added initial version of RPC info API
* Fixed client splash
Diffstat (limited to 'contrib/package/ffluci-splash/src/luci-splash')
-rw-r--r--contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi15
1 files changed, 14 insertions, 1 deletions
diff --git a/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi b/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi
index 4cbddc0c5b..91a6b3397f 100644
--- a/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi
+++ b/contrib/package/ffluci-splash/src/luci-splash/htdocs/cgi-bin/index.cgi
@@ -7,22 +7,35 @@ require("ffluci.sys")
require("ffluci.model.uci")
local srv
+local net
local ip = ffluci.http.remote_addr()
for k, v in pairs(ffluci.model.uci.show("network").network) do
if v[".type"] == "interface" and v.ipaddr then
local p = ffluci.sys.net.mask4prefix(v.netmask)
if ffluci.sys.net.belongs(ip, v.ipaddr, p) then
+ net = k
srv = v.ipaddr
break
end
end
end
+local stat = false
+for k, v in pairs(ffluci.model.uci.show("luci_splash").luci_splash) do
+ if v[".type"] == "iface" and v.network == net then
+ stat = true
+ end
+end
+
if not srv then
ffluci.http.textheader()
return print("Unable to detect network settings!")
end
+if not stat then
+ ffluci.http.redirect("http://" .. srv)
+end
+
local action = "splash"
local mac = ffluci.sys.net.ip4mac(ip)
@@ -30,7 +43,7 @@ if not mac then
action = "unknown"
end
-local status = ffluci.sys.exec("luci-splash status "..mac)
+local status = ffluci.sys.execl("luci-splash status "..mac)[1]
if status == "whitelisted" or status == "lease" then
action = "allowed"