Jump to content
MakeWebGames

Could Someone Fix


SMOKEY_TEK

Recommended Posts

I made a Mccode V2 forum to work on GRPG, but it's not really working... I tried creating topics and it's not even showing up in anything.. Could someone either help me fix this or let me buy a copy of their forum for GRPG.

 

<?php
include (DIRNAME(__FILE__) . '/header.php');
include (DIRNAME(__FILE__) . '/parser.php');

echo "<div class='content'><h3>Forums</h3>";

function forums_rank($tp)
{

if ( $tp < 3 ) { return "#1 Absolute Newbie"; }
else if ( $tp < 7 ) { return "#2 Newbie"; }
else if ( $tp < 12 ) { return "#3 Beginner"; }
else if ( $tp < 18 ) { return "#4 Not Experienced"; }
else if ( $tp < 25 ) { return "#5 Rookie"; }
else if ( $tp < 50 ) { return "#6 Average"; }
else if ( $tp < 100 ) { return "#7 Good"; }	
else if ( $tp< 200 ) { return "#8 Very Good"; }
else if ( $tp < 350 ) { return "#9 Greater Than Average"; }
else if ( $tp < 500 ) { return "#10 Experienced"; }
else if ( $tp < 750 ) { return "#11 Highly Experienced"; }
else if ( $tp < 1200 ) { return "#12 Honoured"; }
else if ( $tp < 1800 ) { return "#13 Highly Hounoured"; }
else if ( $tp < 2500 ) { return "#14 Respect King"; }
else if ( $tp < 5000) { return "#15 True Champion"; }
}

$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? trim($_GET['action']) : 'forum_index';
$_GET['viewforum']=(int) $_GET['viewforum'];
if($_GET['viewtopic'] and $_GET['action'] != 'quote') { $_GET['action']='viewtopic'; }

if($_GET['viewforum']) { $_GET['action']='viewforum'; }
if($_GET['reply']) { $_GET['action']='reply'; }
if($_GET['empty']==1 && $_GET['code']=='kill' && $_SESSION['owner'])
{
emptyallforums();
}
switch($_GET['action'])
{
case 'viewforum' : view_forum(); break;
case 'viewtopic' : view_topic(); break;
case 'reply' : reply_reply(); break;
case 'newtopicform' : new_topicform(); break;
case 'newtopic' : new_topic(); break;
case 'quote' : quote_quote(); break;
case 'edit' : edit_edit(); break;
case 'editsubmit' : edit_submit(); break;
case 'lock' : lock(); break;
case 'delepost' : delete_post(); break;
case 'deletopic' : delete_topic(); break;
case 'pin' : pin_pin(); break;
case 'recache' : recache_forum($_GET['forum']); break;
default : forum_index(); break;
}

function forum_index()
{
echo "
<table width='100%' id='forum'>
   <tr>
       <td colspan='4' class='forumBreadTrail'><a href='forums.php'>Forum</a></td>
   </tr>
<tr>
	<td width='50%'><h4>Forum</h4></td>
	<td width='12%'><h4>Topics</h4></td>
	<td width='12%'><h4>Posts</h4></td>
	<td width='26%'><h4>Last Post</h4></td>
</tr>";

$result = mysql_query("SELECT * FROM `forum_forums` WHERE `ff_auth` = 'public' ORDER BY `ff_id` ASC") or die(mysql_error());
while( $row = mysql_fetch_array($result)){

$date = date(d." ".M." ".y.", ".g.":".i." ".a,$row['ff_lp_time']);
echo "
<tr>
	<td width='50%' align='center'><a href='forums.php?viewforum=".$row['ff_id']." style='font-weight: 800'>".$row['ff_name']."</a><br><small>".$row['ff_desc']."</small></td>
	<td width='12%' align='center'>".$row['ff_topics']."</td>
	<td width='12%' align='center'>".$row['ff_posts']."</td>
	<td width='26%' align='center'>".$date." <br> 
	In: <a href='forums.php?viewtopic=".$row['ff_lp_t_id']."&lastpost=1' style='font-weight: 800'>".$row['ff_lp_t_name']."</a><br>
	By: <a href='profiles.php?id=".$row['ff_lp_poster_id']."'>".$row['ff_lp_poster_name']."</a></td>
</tr>";
}
echo "</table>";

if($user_class->staff == 1){
echo "
<h3>Staff Only Forums</h3>
<table width='100%'>
<tr>
	<td width='50%'><h4>Forum</h4></td>
	<td width='12%'><h4>Topics</h4></td>
	<td width='12%'><h4>Posts</h4></td>
	<td width='26%'><h4>Last Post</h4></td>
</tr>";

$result = mysql_query("SELECT * FROM `forum_forums` WHERE `ff_auth` = 'staff' ORDER BY `ff_id` ASC") or die(mysql_error());
while($row = mysql_fetch_array($result)){

$lastPost = new User($row['ff_lp_poster_id']);
$date = date(d." ".M." ".y.", ".g.":".i." ".a,$row['ff_lp_time']);
echo "
<tr>
	<td width='50%' align='center'><a href='forums.php?viewforum=".$row['ff_id']."' style='font-weight: 800'>".$row['ff_name']."</a> <br> <small>".$row['ff_desc']."</small></td>		<td width='12%' align='center'>".$row['ff_topics']."</td>
	<td width='12%' align='center'>".$row['ff_topics']."</td>
	<td width='12%' align='center'>".$row['ff_posts']."</td>
	<td width='26%' align='center'>".$date." <br> 
	In: <a href='forums.php?viewtopic=".$row['ff_lp_t_id']."&lastpost=1' style='font-weight: 800'>".$row['ff_lp_t_name']."</a> <br>
	By: <a href='profiles.php?id=".$row['ff_lp_poster_id']."'>".$lastPost->formattedname."</a></td>
</tr>";
}
echo "</table>";
}
}

function view_forum()
{
$result = mysql_query("SELECT * FROM `forum_forums` WHERE `ff_id` = '".$_GET['viewforum']."'");
$row = mysql_fetch_array($result);

if($_GET['viewforum'] <> 1 OR $user_class->staff == 1)
{
$ntl=" [<a href='forums.php?action=newtopicform&forum=".$_GET['viewforum']."'>New Topic</a>]";
} else {
$ntl="";
}
echo "
<table width='100%'>
<tr>
	<td colspan='4' class='forumBreadTrail'><a href='forums.php'>Forums</a> » <a href='forums.php?viewforum=".$_GET['viewforum']."'>".$row['ff_name']."</a></td>
</tr>
</table>

<table width='100%'>
<tr>
	<td width=25%><h4>Topic</h4></td>
	<td width=25%><h4>Starter</h4></td>
	<td width='10%'><h4>Posts</h4></td>
	<td width=15%><h4>Last Post</h4></td>
</tr>
</table>";

echo "
<h3>New Topic</h3>
<form action='forums.php?action=newtopic&forum=".$_GET['viewforum']."' method='post'>
<table width='100%'>
<tr>
	<td width='25%'><h4>Topic Title</h4></td>
	<td><input type='text' name='title' size='70'></td>
</tr>
<tr>
	<td colspan='2'><h4>Body</h4></td>
</tr>
<tr>
	<td colspan='2' align='center'><textarea name='message' cols='70' rows='10'></textarea></td>
</tr>
<tr>
	<td colspan='2' align='center'><input type='submit' value='Post' /></td>
</tr>
</form>
</table>";

$result = mysql_query("SELECT * FROM `forum_topics` WHERE `ft_forum_id` = '".$_GET['viewforum']."' ORDER BY `ft_pinned` DESC, `ft_last_time` DESC") or die(mysql_error());
while ($row2 = mysql_fetch_row($result)){

$threadOwner = new User($row2['ft_owner_id']);
$lastPoster = new User($row2['ft_last_id']);
$t1 = date('F j Y, g:i:s a',$row2['ft_start_time']);
$t2 = date('F j Y, g:i:s a',$row2['ft_last_time']);

if($row2['ft_pinned']) { $pt="<b>Pinned:</b> "; } else { $pt=""; }
if($row2['ft_locked']) { $lt=" <b>Locked:</b>"; } else { $lt=""; }

echo "
<table width='100%'>
<tr>
	<td width='25%' align='center'>".$pt." ".$lt." <a href='forums.php?viewtopic=".$row2['ft_id']."&lastpost=1'>".$r2['ft_name']."</a></td>
	<td width='25%' align='center'><a href='profiles.php?id=".$row2['ft_owner_id']."'>".$threadOwner->formattedname."</a></td>
	<td width='10%' align='center'>".$row2['ft_posts']."</td>
	<td width='15%' align='center'>".$t2." <br>
	By: <a href='profiles.php?id=".$row2['ft_last_id']."'>".$lastPoster->formattedname."</a></td>
</tr>";
}
echo "</table>";
}

function view_topic()
{
$result = mysql_query("SELECT * FROM `forum_topics` WHERE `ft_id` = '".$_GET['viewtopic']."'");
$topic = mysql_fetch_array($result);
$result2 = mysql_query("SELECT * FROM `forum_forums` WHERE `ff_id` = '".$topic['ft_forum_id']."'");
$forum = mysql_fetch_array($result2);
echo "
<table width='100%'>
<tr>
	<td colspan='4' class='forumBreadTrail'><a href='forums.php'>Forums</a> » <a href='forums.php?viewforum=".$forum['ff_id']."'>".$forum['ff_name']."</a> » <a href='forums.php?viewtopic=".$_GET['viewtopic']."'>".$topic['ft_name']."</a></td>
</tr>
</table>";

$posts_per_page=20;
$posts_topic=$topic['ft_posts'];
$pages=ceil($posts_topic/$posts_per_page);
$st= ($_GET['st']) ? $_GET['st'] : 0;
if($_GET['lastpost']) { $st=($pages-1)*20; }
$pst=-20;
echo "Pages: ";
for($i=1;$i<=$pages;$i++){
$pst+=20;
echo "<a href='forums.php?viewtopic=".$topic['ft_id']."&st=".$pst."'>";
if($pst == $st) { echo "<b>"; }
echo $i;
if($pst == $st) { echo "</b>"; }
echo "</a> ";
if($i % 25 == 0) { echo "<br />"; }
}
echo "<br />";
if($user_class->staff > 1){
echo "
<form action='forums.php?action=move&topic=".$_GET['viewtopic']."' method='post'><b>Move topic to:</b> ".forum_dropdown($c, 'forum', -1)."<input type='submit' value='Move' /></form><br />
<a href='forums.php?action=pin&topic=".$_GET['viewtopic']."'><img src='sticky.jpg' alt='Pin/Unpin Topic' title='Pin/Unpin Topic' /></a><a href='forums.php?action=lock&topic=".$_GET['viewtopic']."'><img src='lock.jpg' alt='Lock/Unlock Topic' title='Lock/Unlock Topic' /></a><a href='forums.php?action=deletopic&topic=".$_GET['viewtopic']."'><img src='delete.gif' alt='Delete Topic' title='Delete Topic' /></a><br />";
}
echo "
<table width='100%'>";
$result = mysql_query("SELECT * FROM `forum_posts` WHERE `fp_topic_id` = '".$topic['ft_id']."' ORDER BY `fp_time` ASC LIMIT $st, 20");
$no=$st;
while( $row = mysql_fetch_array($result)){
$poster = new User($row['fp_poster_id']);
$qlink = "[<a href='forums.php?action=quote&viewtopic=".$_GET['viewtopic']."&quotename=". strip_tags($row['fp_poster_name']). "&quotetext=".urlencode($row['fp_text']). "'>Quote Post</a>]";
if($user_class->staff > 1 || $user_class->id == $row['fp_poster_id']){
$elink="<a href='forums.php?action=edit&post=".$row['fp_id']."&topic=".$_GET['viewtopic']."'>EDIT POST</a>";
} else { $elink=""; }
$no++;
if($no > 1 and $user_class->staff > 1) { $dlink="[<a href='forums.php?action=delepost&post=".$r['fp_id']."'>Delete Post</a>]"; }
else { $dlink=""; }
$t = date('F j Y, g:i:s a',$row2['fp_time']);
if($r['fp_edit_count'] > 0) { $edittext="\n<br /><i>Last edited by <a href='viewuser.php?u={$r['fp_editor_id']}'>{$r['fp_editor_name']}</a> at ".date('F j Y, g:i:s a',$r['fp_editor_time']).", edited <b>{$r['fp_edit_count']}</b> times in total.</i>"; } else { $edittext=""; }
if(!$precache[$r['fp_poster_id']]['userid']){
$membq = mysql_query("SELECT * FROM `users` WHERE `id` = '".$row['fp_poster_id']."'");
$memb = mysql_fetch_array($membq);
$precache[$memb['id']] = $memb;
} else {
$memb = $precache[$row['fp_poster_id']];
}
$rank = forums_rank($memb['posts']);
if($user_class->avatar) { $avatar = "<img src='".$user_class->avatar."' width='100' height='100'>"; } else { $avatar = ""; }
echo "
<tr>
	<td class='forumSide' align='center' valign='top'>
       ".$elink." <br>
	".$t." <br>
       <a href='profile.php?id=".$row['fp_poster_id']."'>".$avatar."</a><br />
	".$poster->formattedname."<br />
       ".$rank." <br /></td>
	<td class='forumPost' valign='top'>";
	$formatted_text=bb_code(bbcode(nl2br($row['fp_text'])));
	echo $formatted_text; echo "</td>
</tr>";
}
echo "</table>";
$pst=-20;
echo "Pages: ";
for($i=1;$i<=$pages;$i++){
$pst+=20;
echo "<a href='forums.php?viewtopic=".$topic['ft_id']."&st=".$pst."'>";
if($pst == $st) { echo "<b>"; }
echo $i;
if($pst == $st) { echo "</b>"; }
echo "</a> ";
if($i % 25 == 0) { echo "<br />"; }
}
if(!$topic['ft_locked']){
echo "<br><br>
<h3>New Reply</h3>
<form action='forums.php?reply=".$topic['ft_id']."' method='post'>
<table width='100%'>
<tr>
	<td colspan='2' align='center'><textarea name='forumPost' cols='70' rows='10'></textarea></td>
</tr>
<tr>
	<td colspan='2' align='center'><input type='submit' value='Post' /></td>
</tr>
</form>
</table>";
} else {
echo "<p align='center'>This thread is locked.</p>"; die();
}
}

function reply_reply()
{
if(!$topic['ft_locked']){

$result = mysql_query("SELECT * FROM `forum_topics` WHERE `ft_id` = '".$_GET['reply']."'");
$topic = mysql_fetch_array($result);
$result2 = mysql_query("SELECT * FROM `forum_forums` WHERE `ff_id` = '".$topic['ft_forum_id']."'");
$forum = mysql_fetch_row($result2);
$timestamp = time();

$result = mysql_query("INSERT INTO `forum_posts` (`fp_topic_id`, `fp_forum_id`, `fp_poster_id`, `fp_poster_name`, `fp_time`, `fp_suject`, `fp_text`, `fp_editor_id`, `fp_editor_name`, `fp_editor_time`, `fp_editor_count`)"."VALUES('".$_GET['reply']."', '".$forum['ff_id']."', '".$user_class->id."', '".$user_class->username."', '".$timestamp."', '".$_POST['fp_subject']."', '".$_POST['fp_text']."', 0, '', 0, 0)") or die(mysql_error());
$result = mysql_query("UPDATE `forum_topics` SET `ft_last_id` = '".$user_class->id."', `ft_last_name` = '".$user_class->username."', `ft_last_time` = '".$timestamp."', `ft_posts` = ft_posts+1 WHERE `ft_id` = '".$_GET['reply']."'");
$result = mysql_query("UPDATE `forum_forums` SET `ff_lp_time` = '".$timestamp."', `ff_posts` = ff_posts+1, `ff_lp_poster_id` = '".$user_class->id."', `ff_lp_poster_name` = '".$user_class->username."', `ff_lp_t_id` = '".$_GET['reply']."', `ff_lp_t_name` = '".$topic['ft_name']."' WHERE `ff_id` = '".$forum['ff_id']."'");
$result = mysql_query("UPDATE `users` SET `posts` = posts+1 WHERE `id` = '".$user_class->id."'");

$_GET['lastpost'] = 1;
$_GET['viewtopic'] = $_GET['reply'];
view_topic();
} else {
echo "
This thread is locked. <br> <a href='forums.php?viewtopic=".$_GET['reply']."'>Back</a>";
}
}



function new_topic()
{
$result = mysql_query("SELECT * FROM `forum_forums` WHERE `ff_id` = '".$_GET['forum']."'");
$r = mysql_fetch_array($result);
$timestamp = time();

$result = mysql_query("INSERT INTO `forum_topics` (`ft_forum_id`, `ft_name`, `ft_posts`, `ft_owner_id`, `ft_owner_name`, ft_start_time`, `ft_last_id`, `ft_last_name`, `ft_last_time`, `ft_pinned`, `ft_locked`)"."VALUES ('', '".$_GET['forum'].", '".$_POST['ft_name']."', 0, '".$user_class->id."', '".$user_class->username."', '".$timestamp."', 0, '', 0, 0, 0)");
$i = mysql_insert_id();
$result = mysql_query("INSERT INTO `forum_posts` (`fp_topic_id`, `fp_forum_id`, `fp_poster_id`, `fp_poster_name`, `fp_time`, `fp_subject`, `fp_text`, `fp_editor_id`, `fp_editor_name`, `fp_editor_time`, `fp_edit_count`)"."VALUES ('', '".$i."', '".$r['ff_id']."', '".$user_class->id."', '".$user_class->username."', '".$timestamp."', '".$_POST['message']."', 0, '', 0, 0)") or die(mysql_error());
$result = mysql_query("UPDATE `forum_topics` SET `ft_last_id` = '".$user_class->id."', `ft_last_name` = '".$user_class->username."', `ft_last_time` = '".$timestamp."', `ft_posts` = ft_posts+1 WHERE `ft_id` = '".$i."'");
$result = mysql_query("UPDATE `forum_forums` SET `ff_lp_time` = '".$timestamp."', `ff_posts` = ff_posts+1, `ff_topics` = ff_topics+1, `ff_lp_poster_id` = '".$user_class->id."', `ff_lp_poster_name` = '".$user_class->username."', `ff_lp_t_id` = '".$i."', `ff_lp_t_name` = '".$_POST['ft_name']."' WHERE `ff_id` = ".$r['ff_id']."'");
$result = mysql_query("UPDATE `users` SET `posts` = posts+1 WHERE `id` = '".$user_class->id."'");

$_GET['viewtopic'] = $i;
view_topic();
}
?>
<body onload="alternate('forum')">
</div>
Link to comment
Share on other sites

1. When I click on a thread, for example Introductions I get this in the url area http://www.yourgame.com/forums.php?viewforum=1%20style

2. When I click on the backspace button I get this Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/hitmanm1/public_html/forums.php on line 323

3. When I try to make a new topic it doesn't really work, doesn't insert into the database...

I tried inserting by hand a topic and post in the database, but can't be seen in the actual forums in game..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...