<% local msg = {} if _SESSION["logined"] ~= nil then local domain = _GET["domain"] or _POST["domain"] local strBaseURL = c_GetOptionStr(domain, DOPTION_WEBLINK_URL) if strBaseURL == "" then local listenerlist = c_GetListenerList(domain) for _,listener in pairs(listenerlist) do if type(listener) == "table" and listener["Is_Listening"] == true then if listener["Type"] == "3" or listener["Type"] == "4" then local strPort = ":"..listener["Port"] if listener["Type"] == "3" then strBaseURL = "http://" if listener["Port"] == "80" then strPort = "" end else strBaseURL = "https://" if listener["Port"] == "443" then strPort = "" end end if listener["Ip_Address"] == "*" then strBaseURL = strBaseURL.."127.0.0.1" else strBaseURL = strBaseURL..listener["Ip_Address"] end strBaseURL = strBaseURL..strPort.."/" break end end end end rawset(msg, "code", 0) rawset(msg, "data", strBaseURL) print(json.encode(msg)) else rawset(msg, "code", -1) rawset(msg, "error", "not logged in") print(json.encode(msg)) end %>