starttime = mg.time(true) hostname = pihole.hostname() webhome = pihole.webhome() -- Get name of script by matching whatever is after the last "/" in the URI scriptname = mg.request_info.request_uri:match(pihole.webhome().."(.*)$") -- Fall back to "index.lp" if no match is found (e.g. when accessing the root) if scriptname == nil or string.len(scriptname) == 0 then scriptname = "index.lp" end -- Boolean check if string starts with a given prefix function startsWith(text, prefix) return text:find(prefix, 1, true) == 1 end -- Function returning GET parameter value (or nil if not set) function GET(name) return mg.request_info.query_string:match(name.."=([^&]*)") -- mg.get_var(mg.request_info.query_string, "REQUEST_URI") end -- Function checking if val is in tab function in_array (val, tab) for index, value in ipairs(tab) do if value == val then return true end end return false end ?>