public static function authed() { $client_ip = LIBLIB::client_ip(); session_start(); if ($client_ip != FALSE && $_SESSION["authed"] == TRUE) { $hash = sha1(AuthConfig::$spice . $client_ip); if ($_SESSION["auth"] == $hash) { return; } } header("Location: /404"); exit; }
public function post() { $username = $_POST["username"]; $password = $_POST["password"]; $client_ip = LIBLIB::client_ip(); if ($username == LoginConfig::$username && $password == LoginConfig::$password && $client_ip != FALSE) { session_start(); $_SESSION["auth"] = sha1(AuthConfig::$spice . $client_ip); $_SESSION["authed"] = TRUE; header("Location: /kontroltaarn"); } else { // Security through obscurity :D header("Location: /404"); exit; } }