<table > <tr> <td style="text-align:left; width: 50px">Thread: </td> <td> <?php echo "<a href=\"thread.php?thread={$post['thread_id']}\"> " . get_value_from_db("threads", "thread_name", "thread_id", $post['thread_id']) . "</a>"; ?> </td> </tr> <tr> <td style="text-align:left; width: 50px">Poster: </td> <td> <?php echo "<a href=\"profile.php?user={$post['posted_by']}\"> " . get_value_from_db("users", "username", "user_id", $post['posted_by']); ?> </td> </tr> <form method="post" action="validation.php"> <tr> <td colspan="2" style="text-align:left"> Content: <br /> <textarea name="post_content" rows="15" cols="70" class="textarea"><?php echo $post['content']; ?> </textarea> </td> </tr> <tr><td colspan="2">
echo "</a>"; echo "</span>"; } echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"post_user\">"; echo "<a href=\"profile.php?user={$poster_id}\">\n\t\t\t\t<img src=\"{$poster_image}\" width=\"180\" height=\"220\">\n\t\t\t \t{$poster}\n\t\t\t </a><br />"; echo ucfirst($poster_rank); echo "</td>"; echo "<td class=\"post_content\">"; echo "<div class=\"post_message\" >"; echo nl2br(bbcodeParser($content)); echo "</div>"; if ($post['edited']) { $editor = get_value_from_db("users", "username", "user_id", $post['edited_by']); $time_edited = strftime("%m-%d-%y, %I:%M %p", strtotime($post['edited_time'])); echo "<div class=\"post_edited\" >"; echo "Last edited by "; echo "<a href=\"profile.php?user={$post['edited_by']}\">{$editor}</a> on {$time_edited}"; echo "</div>"; } if ($poster_signature != null) { echo "<div class=\"post_signature\" >"; echo $poster_signature; echo "</div>"; } echo "</td>"; echo "</tr>"; } echo "</table>";
die("Error executing query: " . mysql_error()); } else { close_connection($connection); redirect_to("index_.php"); } } else { close_connection($connection); redirect_to("error.php?errors=" . urlencode(implode(",", $errors))); } } //delete forum if ($_POST['submit'] == "Delete" && $_POST['action'] == "delete_forum") { connect_to_database(); select_database(); $forum_id = $_POST['forum_id']; $section_id = get_value_from_db("forums", "section_id", "forum_id", $forum_id); if (get_num_rows("threads", "forum_id", $forum_id) == 0) { //means that the forum is empty $query = " DELETE FROM forums\n\t\t\t\t\t\tWHERE forum_id = {$forum_id}\n\t\t\t"; } else { $query = "\n\t\t\t\tDELETE FROM \n\t\t\t\t forums, threads, posts \n\t\t\t\tUSING \n\t\t\t\t forums\n\t\t\t\tJOIN \n\t\t\t\t threads ON forums.forum_id = threads.forum_id\n\t\t\t\tJOIN \n\t\t\t\t posts ON threads.thread_id = posts.thread_id\n\t\t\t\tWHERE \n\t\t\t\t forums.forum_id = '{$forum_id}'\n\t\t\t"; } $result = mysql_query($query, $connection); if (!$result) { die("Database query failed: " . mysql_error()); } //arange position order $query = "SET @pos := 0 "; $result = mysql_query($query, $connection); if (!$result) { die("Error executing query: " . mysql_error());
echo "<tr><td colspan=\"3\" class=\"center bold\">There are currently no threads in this forum.</td></tr>"; } else { foreach ($threads as $thread) { $poster_id = $thread['author_id']; $last_poster_id = get_value_from_db("posts", "posted_by", "post_id", $thread['last_post_id']); $num_of_threads = get_num_rows("posts", "thread_id", $thread['thread_id']) - 1; $last_post = "#" . $thread['last_post_id']; echo "<tr>"; echo "<td class=\"table_name\">"; if ($thread['locked']) { echo "<span class=\"locked\">"; echo "<img src=\"images/lock.png\" width=\"20\" height=\"25\" title=\"This Thread is locked.\" style=\"vertical-align:bottom\">"; echo "</span>"; } echo "<a href=\"thread.php?thread={$thread['thread_id']}\">{$thread['thread_name']}</a>"; echo "<div class=\"description\">by <a href=\"profile.php?user={$poster_id}\">" . get_value_from_db("users", "username", "user_id", $poster_id) . "</a></div>"; echo "</td>"; echo "<td class=\"table_thread\">" . $num_of_threads . "</td>"; echo "<td class=\"table_thread\">"; echo "<a href=\"profile.php?user={$last_poster_id}\">" . get_value_from_db("users", "username", "user_id", $last_poster_id) . "</a>"; echo "<a href=\"thread.php?thread={$thread['thread_id']}{$last_post}\">>></a><br />"; echo strftime("%m-%d-%y, %I:%M %p", strtotime($thread['last_post_time'])); echo "</td>"; echo "</tr>"; } } echo "</table>"; echo "<div class=\"listBottom\">"; echo "</div>"; echo "</div>"; require_once "shared/footer.php";
redirect_to("no_permission.php"); } $forum_id = $_POST['forum_id']; ?> <div class="outerBox"> <div class="titleBox">Create a Thread</div> <form method="post" action="validation.php"> <div class="innerBox"> <?php connect_to_database(); select_database(); ?> Forum: <?php echo get_value_from_db("forums", "forum_name", "forum_id", $forum_id); ?> <input type="text" name="title" class="postTitle" placeholder="Thread Title"> <textarea name="content" cols="10" rows="10" class="postText"></textarea> </div> <div class="lowerBox"> <input type="hidden" name="forum_id" value="<?php echo $forum_id; ?> " > <input type="submit" name="submit" value="Post" class="buttonMain"> </div> </form> </div>
redirect_to("no_permission.php"); } $thread_id = $_POST['thread_id']; ?> <div class="outerBox"> <div class="titleBox">Reply to thread</div> <form method="post" action="validation.php"> <div class="innerBox"> <?php connect_to_database(); select_database(); ?> Reply To: <?php echo get_value_from_db("threads", "thread_name", "thread_id", $thread_id); ?> <textarea name="content" cols="10" rows="10" class="postText"></textarea> </div> <div class="lowerBox"> <input type="hidden" name="thread_id" value="<?php echo $thread_id; ?> " > <input type="submit" name="submit" value="Reply" class="buttonMain"> </div> </form> </div> <?php