<% include("language.html") local username = _POST["username"] or _GET["username"] or "" local password = _POST["password"] or _GET["password"] or "" local remember = _POST["remember"] or _GET["remember"] or "" username = string.gsub(username,"%%20"," ") password = string.gsub(password,"%%20"," ") if c_CheckAdmin(username,password) == false or c_CheckAdminIp(username,_REMOTE_IP) == false then c_AddAdminFailedIp(_REMOTE_IP) c_AddAdminLog("administrator '"..username.."'(IP:".._REMOTE_IP..") login failed!",ADMIN_LOG_ERROR) print("
") else if _COOKIE["UIDADMIN"] ~= nil then _SESSION_ID = _COOKIE["UIDADMIN"] local retval = SessionModule.load(_SESSION_ID) if retval == false then _SESSION_ID = SessionModule.new() if _UseSSL == true then _SETCOOKIE = _SETCOOKIE.."Set-Cookie: UIDADMIN=".._SESSION_ID.."; HttpOnly; secure\r\n" else _SETCOOKIE = _SETCOOKIE.."Set-Cookie: UIDADMIN=".._SESSION_ID.."; HttpOnly\r\n" end rawset(_COOKIE,"UIDADMIN",_SESSION_ID) end else _SESSION_ID = SessionModule.new() if _UseSSL == true then _SETCOOKIE = _SETCOOKIE.."Set-Cookie: UIDADMIN=".._SESSION_ID.."; HttpOnly; secure\r\n" else _SETCOOKIE = _SETCOOKIE.."Set-Cookie: UIDADMIN=".._SESSION_ID.."; HttpOnly\r\n" end rawset(_COOKIE,"UIDADMIN",_SESSION_ID) end rawset(_SESSION,"logined","true") rawset(_SESSION,"ipaddress",_REMOTE_IP) rawset(_SESSION,"admin",username) for _,domain in pairs(c_GetDomainList()) do local online = tostring(c_IsDomainOnline(domain)) rawset(_SESSION,"online_"..domain,online) end if c_GetAdminType(username) == true then rawset(_SESSION,"admin_readonly",1) else rawset(_SESSION,"admin_readonly",0) end local domainadmin,domainlist,basefolder = c_GetDomainAdminType(username) rawset(_SESSION,"admin_domainadmin",domainadmin) rawset(_SESSION,"admin_domainlist",domainlist) rawset(_SESSION,"admin_basefolder",basefolder) rawset(_SESSION,"admin_nowpath",basefolder) SessionModule.save(_SESSION_ID) c_ClearAdminSession() c_RemoveAdminFailedIp(_REMOTE_IP) c_AddAdminLog("administrator '"..username.."'(IP:".._REMOTE_IP..") logged in ok!",ADMIN_LOG_OK) if remember ~= "" then setcookie("admin_login_name",username,900000000) end if _COOKIE["admin_lang"] == nil then _COOKIE["admin_lang"] = "english" end print("
") end %>