Welcome to the Forums, where you can take part in public online discussions.
\n"; // if action is not set, show the front page if ($_GET["action"]==""){ $html .= "| Forum List | |
\n";
$result = mysql_query($sql,$con);
if ($result!=false){
if (mysql_num_rows($result)>0){
$html .= "
problem with SQL [".$sql."] \n";
}
// finish the common border
$html .= " |
| Forum Description | ||||||||||||||||||||||||
\n";
// show the forum name
$sql = "SELECT f.nForumId,f.cType,f.cStatus,f.cTitle,f.cSummary,f.nPosts,f.nTopics,f.nOwnerId,uo.cUsername AS cOwner,f.nLastPostBy,ul.cUsername AS cLastPoster,f.dLastPost,f.nLastPostId"
." FROM nexus_forums f"
." INNER JOIN nexus_users uo ON f.nOwnerId=uo.nUserId"
." LEFT OUTER JOIN nexus_users ul ON f.nLastPostBy=ul.nUserId"
." WHERE nForumId=".$_GET["forumid"];
$result = mysql_query($sql,$con);
if ($result!=false){
if (mysql_num_rows($result)>0){
$row = mysql_fetch_array($result);
switch($member_type){
case "owner":
$html_newtopic = "";
break;
case "moderator":
$html_newtopic = "";
break;
case "member":
$html_newtopic = "";
break;
case "pending":
$html_newtopic = " You Cannot Post ";
break;
case "banned":
$html_newtopic = "Your membership of this forum is pending approval of its owner. You Cannot Post ";
break;
default:
switch($row["cType"]){
case "open": // user is joined immediately on join request
$html_newtopic = "";
break;
case "managed": // user is added as pending on join request
$html_newtopic = "";
break;
}
break;
}
// figure out if the forum is open or not
if ($row["cStatus"]=="live"){
$html .= "You have been banned from posting to this forum.
".stripslashes($row["cTitle"])." Forum \n"
."This forum has been requested for creation, but has not been enabled yet. Please contact the administrator if you have any questions, or would just like to lean on him a bit :) \n";
}
if ($row["cStatus"]=="closed"){
$html .= "".stripslashes($row["cTitle"])." Forum \n"
."This forum has been closed. Please contact the administrator if you have any questions. \n";
}
} else {
// no forums to list
}
} else {
$html .= "problem with SQL [".$sql."] \n";
}
$html .= " | ||||||||||||||||||||||||
\n";
if ($row["cStatus"]=="live"){
// get the posts
$sql = "SELECT t.nTopicId,t.cTitle AS cTopicTitle,t.nForumId,f.cTitle AS cForumTitle,t.nFirstPostId,t.nLastPostId,uf.cUsername AS cFirstPostBy,ul.cUsername AS cLastPostBy,t.nFirstPostBy,t.nLastPostBy,t.dFirstPost,t.dLastPost,t.nPosts,t.nViews"
." FROM nexus_topics t"
." INNER JOIN nexus_forums f ON t.nForumId=f.nForumId"
." INNER JOIN nexus_users uf ON t.nFirstPostBy=uf.nUserId"
." INNER JOIN nexus_users ul ON t.nLastPostBy=ul.nUserId"
." WHERE t.nForumId=".$_GET["forumid"]
." ORDER BY t.dLastPost DESC;";
$result = mysql_query($sql,$con);
if ($result!=false){
$html .= "
Problem with the SQL [".$sql."] \n"; } } else { // forum is not live $html .= "The forum contents cannot be shown while it's status is not 'live'. ";
}
$html .= " | ||||||||||||||||||||||||
| Forum Description | ||||
\n";
// show the forum name
$sql = "SELECT f.nForumId,f.cTitle,f.cSummary,f.nPosts,f.nTopics,f.nOwnerId,uo.cUsername AS cOwner,f.nLastPostBy,ul.cUsername AS cLastPoster,f.dLastPost,f.nLastPostId"
." FROM nexus_forums f"
." INNER JOIN nexus_users uo ON f.nOwnerId=uo.nUserId"
." INNER JOIN nexus_users ul ON f.nLastPostBy=ul.nUserId"
." WHERE nForumId=".$forumid;
$result = mysql_query($sql,$con);
if ($result!=false){
if (mysql_num_rows($result)>0){
$row = mysql_fetch_array($result);
$html .= "
problem with SQL [".$sql."] \n";
}
$html .= " | ||||
\n";
$html .= " Topic : ".$topic_title." \n";
// get the posts in the topic
$sql = "SELECT p.nPostId,p.nForumId,p.nTopicId,p.nUserId,u.cUsername,p.cTitle,p.cBody,p.dAdded,p.dEdited,u.nPosts,u.cGender,u.cChatYahoo,u.cChatMSN,u.cChatAIM,u.cChatICQ"
." FROM nexus_posts p"
." INNER JOIN nexus_users u ON p.nUserId=u.nUserId"
." WHERE nTopicId=".$topicid." ORDER BY nPostId";
$result = mysql_query($sql,$con);
if ($result!=false){
$html .= "
Problem with the SQL [".$sql."] \n"; } $html .= " |
Login Required
\n" ."You are trying to access a section of the site that requires a login. Use the form on the left to login - you will then be taken to the page you were trying to access.
\n" ."If you get stuck, email ".$admin_email." for assistance.
\n"; } } // if action is 'reply' show the reply form if ($_GET["action"]=="reply"){ if ($_SESSION["nexus_userid"]!="" && $_SESSION["nexus_enabled"]!=""){ $forumid = $_GET["forumid"]; $topicid = $_GET["topicid"]; $postid = $_GET["postid"]; // get data of the message we are replying to $con = db_connect(); $sql = "SELECT p.cTitle,p.cBody,p.dAdded,p.dEdited,u.cUsername,p.nUserId" ." FROM nexus_posts p" ." INNER JOIN nexus_users u ON p.nUserId=u.nUserId" ." WHERE p.nPostId=".$postid; $result = mysql_query($sql,$con); if ($result!=false){ if (mysql_num_rows($result)>0){ $row = mysql_fetch_array($result); // show the message they are replying to $html .= "| Reply to this message by ".stripslashes($row["cUsername"]).", written on ".$row["dAdded"]." |
".stripslashes($row["cTitle"])." ".prepare(stripslashes($row["cBody"]))." |
Problem with the SQL [".$sql."]
\n"; } } else { // enabled account required $html .= "Login Required
\n" ."You are trying to access a section of the site that requires a login. Use the form on the left to login - you will then be taken to the page you were trying to access.
\n" ."If you get stuck, email ".$admin_email." for assistance.
\n"; } } $html .= html_page_end(); print $html; ?>