$user) { if ($result["id"] === $id && in_array("login", $user)) { $login = true; } } if ($login) { $token = bin2hex(random_bytes(32)); file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/tokens/" . $token, json_encode($result)); setcookie("ADMIN_TOKEN", $token, 0, "/", ".minteck.ro.lt", true, true); header("Location: /admin"); } else { header("Location: /?admin"); } }