die; } $username = $_SESSION['username']; if (isset($_GET['id'])) { $username = $_GET['id']; } $user_profile = get_profile($username); if ($user_profile == null) { die("Could not get user profile"); } if (isset($_GET['action'])) { if ($_GET['action'] == "addmoderator") { if (!isset($_GET['id'])) { die("Must specify id for this action"); } make_moderator($_GET['id']); } else { if ($_GET['action'] == "removemoderator") { if (!isset($_GET['id'])) { die("Must specify id for this action"); } remove_moderator($_GET['id']); } else { if ($_GET['action'] == "delete") { delete_user($_SESSION['username']); session_destroy(); $_SESSION = array(); //die("Your account has been removed from the database."); header("Location: login.php", true); } }
<?php /** * @brief Tee moderaattori * @file make_moderator.php */ /** * Tee moderaattori */ function make_moderator() { $result = pg_prepare($dbconn, "make_moderator", 'UPDATE users SET a_moderator = 1 WHERE email = $1', array($_POST['login']['email'])); } make_moderator();