setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $userManager = new \pvv\admin\UserManager($pdo); require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php'); $as = new SimpleSAML_Auth_Simple('default-sp'); $as->requireAuth(); $attrs = $as->getAttributes(); $uname = $attrs['uid'][0]; if(!isset($_POST['title']) or !isset($_POST['content'])){ header('Location: ' . $_SERVER['HTTP_REFERER']); exit(); } if(!$userManager->isAdmin($uname)){ echo 'Her har du ikke lov\'t\'å\'værra!!!'; exit(); } $query = 'UPDATE motd SET title=:title, content=:content'; $statement = $pdo->prepare($query); $statement->bindParam(':title', $_POST['title'], PDO::PARAM_STR); $statement->bindParam(':content', $_POST['content'], PDO::PARAM_STR); $statement->execute(); header('Location: .'); ?> Om du ikke ble automatisk omdirigert tilbake klikk her