prepare("UPDATE blogpost_comments SET poster_id = NULL, content='' WHERE poster_id = :userId;"); $stmt->bindParam(":userId", $_SESSION["current_user"]->user_id); $stmt->execute(); } else if ($deleteContent) { $stmt = $conn->prepare("UPDATE blogpost_comments SET content='' WHERE poster_id = :userId;"); $stmt->bindParam(":userId", $_SESSION["current_user"]->user_id); $stmt->execute(); } else if ($deleteAuthor) { $stmt = $conn->prepare("UPDATE blogpost_comments SET poster_id = NULL WHERE poster_id = :userId;"); $stmt->bindParam(":userId", $_SESSION["current_user"]->user_id); $stmt->execute(); } // Delete the user from the database $stmt = $conn->prepare("DELETE FROM users WHERE user_id = :userId;"); $stmt->bindParam(":userId", $_SESSION["current_user"]->user_id); $stmt->execute(); // Log the user out if (ini_get("session.use_cookies")) { $params = session_get_cookie_params(); setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"] ); } // Redirect to this page with GET header(sprintf("Location: %s?success=true", sanitize_input($_SERVER["PHP_SELF"]))); } if (isset($_POST["submit"])) { // Try to delete the user from db delete_user($conn, sanitize_input($_POST["remove_content"])); } display_header("Delete account"); if(sanitize_input($_GET["success"]) == "true"){ printf("

Deletion succesful.

"); } if(isset($_SESSION["current_user"])){ printf("

Account deletion

You are about to delete your account, this means it will be completely erased from the database, but your contributions will remain, their authors name will now be shown as `[Deleted]` instead of your username. Internally, they will still have your old id set as the author.

If you wish for all your contributions to be seen as been made by a guest (no author id) instead, you can check the checkbox below. Then they will completely loose their authorship info.

If you want to erase their content as well, please enter the string `DELETE CONTENT OF ALL COMMENTS` in all caps into the appropriate input as well. But I would urge you not to do this unless absolutely necessary. Don't we all hate coming up on an interesting thread on the internet only to find the most important/interesting message has been deleted?


%s
", htmlspecialchars($_SERVER["PHP_SELF"]), $confStringErr); } else{ printf("

You are not signed in

Please sign in to delete your account.
"); } include_once($COMMONS."/footer.php"); ?>