get_from_database($_GET['id'], $dbc); if ($result == 0) { http_response_code(404); include_once './includes/templates/404.php'; die(); } } } else { $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT); $delete = filter_input(INPUT_POST, 'delete', FILTER_SANITIZE_STRING); $post_content = filter_input(INPUT_POST, 'post_content', FILTER_SANITIZE_STRING); $post = new Post(); $post->get_from_database($id, $dbc); if (strcasecmp($delete, "on") == 0) { delete_post($post); } else { edit_post($post, $post_content); } header("Location: /viewthread.php?id=" . $post->thread->id); } ?> Manage a post - cflip.net forum

Manage a post

display_content($dbc); echo '
'; $id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); if (!Session::get()->is_signed_in()) { echo '

You must be signed in to manage a post.

'; return; } // Admin users should be able to delete posts, but they should not be able to edit them // Or should they?? if (Session::get()->get_current_user()->id != $current->author->id) { echo '

You can\'t manage another user\'s post!

'; return; } // TODO: Disallow editing/deleting posts if they have been around for a while ?>

Edit post

Edited posts will show a timestamp above the post showing when the last edit was made.