local function HTMLDeleteButton( name ) return "
" end function HandleRequest_WhiteList( Request ) local UpdateMessage = "" if( Request.PostParams["whitelist-add"] ~= nil ) then local PlayerName = Request.PostParams["whitelist-add"] if( WhiteListIni:GetValueB("WhiteList", PlayerName, false) == true ) then UpdateMessage = "".. PlayerName.." is already on the whitelist" else WhiteListIni:SetValueB("WhiteList", PlayerName, true ) UpdateMessage = "Added " .. PlayerName .. " to whitelist." WhiteListIni:WriteFile() end elseif( Request.PostParams["whitelist-delete"] ~= nil ) then local PlayerName = Request.PostParams["whitelist-delete"] WhiteListIni:DeleteValue( "WhiteList", PlayerName ) UpdateMessage = "Removed " .. PlayerName .. " from whitelist." WhiteListIni:WriteFile() elseif( Request.PostParams["whitelist-reload"] ~= nil ) then WhiteListIni:Erase() -- Empty entire loaded ini first, otherwise weird shit goes down WhiteListIni:ReadFile() UpdateMessage = "Loaded from disk" elseif( Request.Params["whitelist-setenable"] ~= nil ) then local Enabled = Request.Params["whitelist-setenable"] local CreateNewValue = false if( WhiteListIni:FindValue( WhiteListIni:FindKey("WhiteListSettings"), "WhiteListOn" ) == cIniFile.noID ) then -- Find out whether the value is in the ini CreateNewValue = true end if( Enabled == "1" ) then WhiteListIni:SetValueB("WhiteListSettings", "WhiteListOn", true, CreateNewValue ) else WhiteListIni:SetValueB("WhiteListSettings", "WhiteListOn", false, CreateNewValue ) end WhiteListIni:WriteFile() end local Content = "" local WhiteListEnabled = WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false) if( WhiteListEnabled == false ) then Content = Content .. "

Whitelist is currently disabled! Click here to enable.

" end Content = Content .. "

Whitelisted players

" Content = Content .. "" local KeyNum = WhiteListIni:FindKey("WhiteList") local NumValues = WhiteListIni:GetNumValues(KeyNum) if( NumValues > 0 ) then for Num = 0, NumValues-1 do if( WhiteListIni:GetValue(KeyNum, Num, "0") == "1" ) then local PlayerName = WhiteListIni:GetValueName(KeyNum, Num ) Content = Content .. "" end end else Content = Content .. "" end Content = Content .. "
" .. PlayerName .. "" .. HTMLDeleteButton( PlayerName ) .. "
None
" Content = Content .. "

Add player to whitelist

" Content = Content .. "
" Content = Content .. "" Content = Content .. "
" Content = Content .. "
" Content = Content .. "" Content = Content .. "
" Content = Content .. "
"..UpdateMessage if( WhiteListEnabled == true ) then Content = Content .. "

Whitelist is currently enabled, click here to disable.

" end return Content end