.
*
* 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 .= ' ' . $post_author . ' - ' . $thread_title . ' - ' . $whenPost . '
';
}
}
?>
Forum |
Ad Space or Whatever |