ok, seeing as the previous guy who released this decided to post "open" pictures of girls and other shit that made up 4/5 of his download, (15 pictures were those shits, and there were 5 significantly smaller files thats the only thing in the donwload significant, and that matters in the forums.) the download got reduced to 5 files, 3 critical images and 2 php files, to cut the size down, i decided to host the images on my own server, and simple use <img src="http://www.memmorpgnetwork.com/image"> instead. so if you want to use this without an internet connection, you can download the 3 images from my site, just CTRL + F for jpeg and gif images in the 2 php files. or just find www.memmorpgnetwork.com. anyway, here's the 2 files:
Name this file forums.php and place it in ur s0wh4t;s cms directory.
make another file called forumsadmin.php and put the following in it:PHP Code:<?php
include("top.php");
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="64">
<span style="float: left;">
<img src="http://www.memmorpgnetwork.com/bbs_forum_title.gif" border="0"></span>
<span style="float: right; padding-top: 3px; line-height: 10px;" class="table_text_11">
</span>
</td>
</tr>
<tr>
<td height="4"></td>
</tr>
<tr>
<td colspan="3" style="background-color: rgb(255, 159, 0);" height="3"></td>
</tr>
<tr>
<td height="4"></td>
</tr>
<center><a href="forumsadmin.php?action=add" border=0><img src="http://www.memmorpgnetwork.com/forum_thread.jpg" border=0></a></center>
<center><a href="http://www.geekms.com" border=0> - </a></center>
<?php
if($_GET['id']){
$id = mysql_real_escape_string($_GET['id']);
$gn = mysql_query("SELECT * FROM `web_forums` WHERE `id`='".$id."'") or die(mysql_error());
$n = mysql_fetch_array($gn);
echo "<tr><td align=left valign=\"top\" bgcolor=\"#FFFFCC\" style=\"padding: 4px;\"><img src=\"http://www.memmorpgnetwork.com/ct_news_forum.gif\"></td>";
echo "<td align=left bgcolor=\"#FFFFCC\" style=\"padding: 4px;\">[".$n['date']."] <b>".stripslashes($n['title'])."</b></b> - Posted by <b><a href=\"members.php?name=".$n['author']."\">".$n['author']."</a></b><br>";
echo nl2br(stripslashes($n['content']))."<br /><br />";
$gc = mysql_query("SELECT * FROM `web_fcomments` WHERE `fid`='".$id."' ORDER BY `id` ASC") or die(mysql_error());
$cc = mysql_num_rows($gc);
echo "Views: <b>".$n['views']."</b> | Comments: <b>".$cc."</b>";
echo "<hr>";
$av = mysql_query("UPDATE `web_forums` SET `views` = views + 1 WHERE `id`='".$id."'") or die(mysql_error());
if($_SESSION['id']){
if($_SESSION['mute']=="1"){
include("mutemessage.php");
}elseif($_SESSION['pname'] == NULL){
echo "You must assign a profile name before you can comment forums articles!";
}else{
echo "<form method=\"POST\">";
echo "<center><table border=\"0\" width=\"200\">";
echo "<tr><td><b>Feedback:</b> <select name=\"feedback\">";
echo "<option value=\"0\">Positive</option>";
echo "<option value=\"1\">Neutral</option>";
echo "<option value=\"2\">Negative</option>";
echo "</select></td></tr>";
echo "<tr><td><b>Comment:</b><br /><textarea name=\"text\" style=\"height:75px;width:100%;\"></textarea></td></tr>";
echo "<tr><td><input type=\"submit\" name=\"comment\" value=\"Comment\" style=\"width:100%;\"></td></tr>";
echo "</table></center>";
echo "</form>";
}
}else{
echo "<center>Please log in to comment!\</center>";
}
if($_POST['comment']){
$feedback = mysql_real_escape_string($_POST['feedback']);
$date = date("m-d-y g:i A");
$comment = htmlspecialchars(mysql_real_escape_string($_POST['text']));
if($comment == ""){
echo "You cannot leave the comment field blank!";
}else{
$i = mysql_query("INSERT INTO `web_fcomments` (`fid`,`author`,`feedback`,`date`,`comment`) VALUES ('".$id."','".$_SESSION['pname']."','".$feedback."','".$date."','".$comment."')") or die(mysql_error());
echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=forums.php?id=".$id."\">";
}
}
echo "<hr>";
if(mysql_num_rows($gc) <= 0){
echo "There are no comments/feedback for this article yet. You can be the first one!";
}else{
while($c = mysql_fetch_array($gc)){
if($c['feedback'] == "0"){
$feedback = "<font color=\"green\">Positive</font>";
}elseif($c['feedback'] == "1"){
$feedback = "<font color=\"gray\">Neutral</font>";
}elseif($c['feedback'] == "2"){
$feedback = "<font color=\"red\">Negative</font>";
}
echo "<fieldset><legend><b>".$c['author']."</b> - ".$c['date']."</legend>";
echo "<b>Feedback:</b> ".$feedback."<br />";
echo "<b>Comment:</b> ".stripslashes($c['comment']);
echo "</fieldset><br />";
}
}
echo "</td><td align=\"right\" valign=\"top\" bgcolor=\"#FFFFCC\" style=\"padding: 4px;\">";
if($_SESSION['admin']){
echo "<a href=\"forumsadmin.php?action=edit&id=".$n['id']."\">Edit</a> | <a href=\"forumsadmin.php?action=del\">Delete</a>";
}
echo "</td></tr>";
}else{
$gn = mysql_query("SELECT * FROM `web_forums` ORDER BY `id` DESC") or die(mysql_error());
while($n = mysql_fetch_array($gn)){
$gc = mysql_query("SELECT * FROM `web_fcomments` WHERE `fid`='".$n['id']."' ORDER BY `id` ASC") or die(mysql_error());
$cc = mysql_num_rows($gc);
echo "<tr><td align=left valign=\"top\" bgcolor=\"#FFFFCC\" style=\"padding: 4px;\"><img src=\"http://www.memmorpgnetwork.com/ct_news_forum.gif\"></td>";
echo "<td align=left bgcolor=\"#FFFFCC\" style=\"padding: 4px;\">[".$n['date']."] <b><a href=\"forums.php?id=".$n['id']."\">".stripslashes($n['title'])."</a></b></td><td align=\"right\" bgcolor=\"#FFFFCC\" style=\"padding: 4px;\"><b>".$n['views']."</b> views | <b>".$cc."</b> comments ";
if($_SESSION['admin']){
echo "- <a href=\"forumsadmin.php?action=edit&id=".$n['id']."\">Edit</a> | <a href=\"forumsadmin.php?action=del\">Delete</a>";
}
echo "</td></tr>";
}
}
?>
</tbody>
</table>
<?php
include("end.php");
?>
run this sql queryPHP Code:<?php
include("top.php");
if($_SESSION['id']){
if($_GET['action']=="add"){
echo "<fieldset><legend><b>Add A forums Article</b></legend>";
if($_SESSION['pname'] == NULL){
echo "Please set up a profile name first!";
}else{
if(!$_POST['add']){
echo "<form method=\"POST\">";
echo "<center><table border=\"0\" width=\"100%\">";
echo "<tr><td align=\"right\"><b>Title:</b></td><td><input type=\"text\" name=\"title\"></td></tr>";
echo "<tr><td align=\"right\"><b>Author:</b></td><td>".$_SESSION['pname']."</td></tr>";
echo "<tr><td align=\"right\" valign=\"top\"><b>Category:</b></td><td>";
echo "<input type=\"radio\" name=\"cat\" value=\"ct_forums_notice_notice\"> <img src=\"http://www.memmorpgnetwork.com/ct_news_forum.gif\"><br />";
echo "</td></tr>";
echo "<tr><td align=\"right\" valign=\"top\"><b>Content:</b></td><td><textarea name=\"content\" style=\"height:100px;width:50%;\"></textarea></td></tr>";
echo "<tr><td></td><td><input type=\"submit\" name=\"add\" value=\"Add\"></td></tr>";
echo "</table></center>";
echo "</form>";
}else{
$title = mysql_real_escape_string($_POST['title']);
$author = $_SESSION['pname'];
$date = date("m.d");
$cat = mysql_real_escape_string($_POST['cat']);
$content = mysql_real_escape_string($_POST['content']);
if($title == ""){
echo "Please supply a title!";
}elseif(empty($cat)){
echo "Please select a category!";
}elseif($content == ""){
echo "Please type in some content!";
}else{
$i = mysql_query("INSERT INTO `web_forums` (`title`,`author`,`type`,`date`,`content`) VALUES ('".$title."','".$author."','".$cat."','".$date."','".$content."')") or die(mysql_error());
echo "The forums article has been added into the database!";
}
}
}
echo "</fieldset>";
}elseif($_GET['action']=="edit"){
echo "<fieldset><legend><b>Edit A forums Article</b></legend>";
if($_GET['id']){
$id = mysql_real_escape_string($_GET['id']);
$gn = mysql_query("SELECT * FROM `web_forums` WHERE `id`='".$id."'") or die(mysql_error());
$n = mysql_fetch_array($gn);
if(!$_POST['edit']){
echo "<form method=\"POST\">";
echo "<center><table border=\"0\" width=\"100%\">";
echo "<tr><td align=\"right\"><b>Title:</b></td><td><input type=\"text\" name=\"title\" value=\"".$n['title']."\"></td></tr>";
echo "<tr><td align=\"right\"><b>Author:</b></td><td>".$n['author']."</td></tr>";
echo "<tr><td align=\"right\" valign=\"top\"><b>Category:</b></td><td>";
echo "<input type=\"radio\" name=\"cat\" value=\"ct_forums_notice_notice\"> <img src=\"http://www.memmorpgnetwork.com/ct_news_forum.gif\"><br />";
echo "</td></tr>";
echo "<tr><td align=\"right\" valign=\"top\"><b>Content:</b></td><td><textarea name=\"content\" style=\"height:100px;width:50%;\">".stripslashes($n['content'])."</textarea></td></tr>";
echo "<tr><td></td><td><input type=\"submit\" name=\"edit\" value=\"Edit\"></td></tr>";
echo "</table></center>";
echo "</form>";
}else{
$title = mysql_real_escape_string($_POST['title']);
$cat = mysql_real_escape_string($_POST['cat']);
$content = mysql_real_escape_string($_POST['content']);
if($title == ""){
echo "Please supply a title!";
}elseif(empty($cat)){
echo "Please select a category!";
}elseif($content == ""){
echo "Please type in some content!";
}else{
$u = mysql_query("UPDATE `web_forums` SET `title`='".$title."',`type`='".$cat."',`content`='".$content."' WHERE `id`='".$id."'") or die(mysql_error());
echo "The forums article has been edited!";
}
}
}else{
echo "Please select an article below:<br /><br />";
$gn = mysql_query("SELECT * FROM `web_forums` ORDER BY `id` DESC") or die(mysql_error());
while($n = mysql_fetch_array($gn)){
echo "#".$n['id']." - <a href=\"forumsadmin.php?action=edit&id=".$n['id']."\">".$n['title']."</a><br />";
}
}
echo "</fieldset>";
}elseif($_GET['action']=="del"){
echo "<fieldset><legend><b>Delete A forums Article</b></legend>";
if(!$_POST['del']){
echo "<form method=\"POST\">";
echo "<center><table border=\"0\">";
echo "<tr><td align=\"right\"><b>Article:</b></td><td><select name=\"art\">";
echo "<option value=\"\">Please select...</option>";
$gn = mysql_query("SELECT * FROM `web_forums` ORDER BY `id` DESC") or die(mysql_error());
while($n = mysql_fetch_array($gn)){
echo "<option value=\"".$n['id']."\">#".$n['id']." - ".$n['title']."</option>";
}
echo "</select></td></tr>";
echo "<tr><td align=\"right\"><b>Delete?</b></td><td><select name=\"dec\">";
echo "<option value=\"0\">No</option>";
echo "<option value=\"1\">Yes</option>";
echo "</select></td></tr>";
echo "<tr><td></td><td><input type=\"submit\" name=\"del\" value=\"Delete\"></td></tr>";
echo "</table></center>";
echo "</form>";
}else{
$art = mysql_real_escape_string($_POST['art']);
$dec = mysql_real_escape_string($_POST['dec']);
if($art == ""){
echo "Please select a forums article to delete!";
}elseif($dec == "0"){
echo "You selected \"No\". Delete unsuccesful!";
}else{
$d = mysql_query("DELETE FROM `web_forums` WHERE `id`='".$art."'") or die(mysql_error());
echo "The forums article has been deleted from the database!";
}
}
echo "</fieldset>";
}
}else{
echo "You are not logged in yet!";
}
include("end.php");
?>
And do the following:Code:CREATE TABLE `web_fcomments` ( `id` INT( 10 ) NOT NULL AUTO_INCREMENT , `fid` INT ( 10 ) NOT NULL , `author` VARCHAR( 16 ) NOT NULL , `feedback` INT( 1 ) NOT NULL , `date` VARCHAR( 32 ) NOT NULL , `comment` TEXT NOT NULL , PRIMARY KEY ( `id` ) ) ENGINE = MYISAM ; CREATE TABLE `web_forums` ( `id` INT( 10 ) NOT NULL AUTO_INCREMENT , `title` VARCHAR( 50 ) NOT NULL , `author` VARCHAR( 16 ) NOT NULL , `date` VARCHAR( 32 ) NOT NULL , `type` VARCHAR( 50 ) NOT NULL , `content` TEXT NOT NULL , `views` INT ( 10 ) NOT NULL DEFAULT '0', PRIMARY KEY ( `id` ) ) ENGINE = MYISAM ;CONFIG.PHP\
Change:
in config.php
toPHP Code:$forumurl = "http://"; /* your forum url */to:
in top.phpPHP Code:$forumurl = "forums.php"; /* your forum url */TOP.PHP
Change:
toPHP Code:<a href="<?php echo $forumurl; ?>" target="_blank">to:
done.PHP Code:<a href="<?php echo $forumurl; ?>">
credits to the guy who originally released this
and me for cleaning up the code/stuffs. :P



Reply With Quote![[release]Cleaned up built in s0wh4t's CMS forums](http://ragezone.com/hyper728.png)


