Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Web Intersect Social Network Template System and CMS v1.34
- * Copyright (c) 2011 Adam Khoury
- * Licensed under the GNU General Public License version 3.0 (GPLv3)
- * http://www.webintersect.com/license.php
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Date: February 9, 2010
- *------------------------------------------------------------------------------------------------*/
- session_start();
- include_once ("../wi_class_files/agoTimeFormat.php");
- $myAgoObject = new convertToAgo;
- include_once "../scripts/connect_to_mysql.php"; // Connect to the database
- // Get the section ID from the url variable coming in
- if (isset($_GET['id']) && $_GET['id'] != "") {
- $sid = preg_replace('#[^0-9]#i', '', $_GET['id']); // filter all characters except numbers for security
- } else {
- echo "ERROR: Variables to run this script have been removed from the URL.";
- exit();
- }
- // Query the database for that section id, make sure it exists and get the section title
- $sql = mysql_query("SELECT * FROM forum_sections WHERE id='$sid' LIMIT 1");
- $numRows = mysql_num_rows($sql);
- if ($numRows < 1) {
- echo "ERROR: That section deos not exist you have tampered with our URLs.";
- exit();
- }
- while($row = mysql_fetch_array($sql)){
- $sectionTitle = $row["title"];
- }
- // Use the section ID to query the "forum_posts" table in the database to get all the threads for this section
- $sql = mysql_query("SELECT * FROM forum_posts WHERE type='a' AND section_id='$sid' ORDER BY date_time DESC LIMIT 25");
- $dynamicList = "";
- $numRows = mysql_num_rows($sql)or die(mysql_error());
- if ($numRows < 1) {
- $dynamicList = "There are no threads in this section yet. You can be the first to post.";
- } else {
- while($row = mysql_fetch_array($sql)){
- $thread_id = $row["id"];
- $post_author = $row["post_author"];
- $post_author_id = $row["post_author_id"];
- $date_time = $row["date_time"];
- $convertedTime = ($myAgoObject -> convert_datetime($date_time));
- $whenPost = ($myAgoObject -> makeAgo($convertedTime));
- $thread_title = $row["thread_title"];
- $dynamicList .= '<img src="style/threadPic.jpg" width="26" height="18" alt="Topic" /> ' . $post_author . ' - <a href="view_thread.php?id=' . $thread_id . '">' . $thread_title . '</a> - ' . $whenPost . '<br />';
- }
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <link href="style/style.css" rel="stylesheet" type="text/css" />
- <title><?php echo $sectionTitle; ?> Forum</title>
- </head>
- <body>
- <?php include_once("template_header.php"); ?>
- <table style="background-color: #F0F0F0; border:#069 1px solid; border-top:none;" width="900" border="0" align="center" cellpadding="12" cellspacing="0">
- <tr>
- <td width="731" valign="top">
- <div id="breadcrumbs"><a href="http://www.webintersect.com">Web Intersect Home</a> ← <a href="http://www.webintersect.com/forum">Forum Home</a></div>
- <h1 style="margin-left:12px;"><?php echo $sectionTitle; ?> Forum</h1>
- <form action="new_topic.php" method="post">
- <input name="forum_id" type="hidden" value="<?php echo $sid; ?>" />
- <input name="forum_title" type="hidden" value="<?php echo $sectionTitle; ?>" />
- <input name="myBtn1" type="submit" value="Create New Topic" style="font-size:16px; padding:12px;" />
- </form>
- <br /><br />
- <div style="margin-left:12px; font-size:14px; line-height:1.5em;"><?php echo $dynamicList; ?></div>
- <br /><br /><br /></td>
- <td width="189" valign="top"><div style=" width:160px; height:600px; background-color: #999; color: #CCC; padding:12px;"> <br />
- <br />
- <br />
- <h3>Ad Space or Whatever</h3>
- </div></td>
- </tr>
- </table>
- <?php include_once("template_footer.php"); ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement