Jump to content
MakeWebGames

Urgent Forum Problem


Pyromann

Recommended Posts

Hi,

i recently bought an mccodes redux version and i found 2 errors on forums.

in viewtopic function

Notice: Undefined index: 1 in D:\Wamp\www\Mods\forums.php on line 86

( ! ) Notice: Undefined offset: 42 in D:\Wamp\www\bbcode_engine.php on line 144

Call Stack

# Time Memory Function Location

1 0.0116 1511680 viewtopic( ) ..\forums.php:168

2 0.0130 1524920 bbcode->bbcode_parse( ) ..\forums.php:96

 

function viewtopic() {
global $ir, $c, $userid, $h, $bbc, $db;
	$precache = array();
	$_GET['viewtopic'] = ( isset($_GET['viewtopic'])&&is_numeric($_GET['viewtopic']) )?abs(intval($_GET['viewtopic'])):'';
    if ( empty($_GET['viewtopic']) ) {
  echo 'Something went wrong.<br />> <a href="'.gen_url('forums',true).'" alt="Go Back" title="Go Back">Go Back</a>';
  die($h->endpage());
    }
$q = $db->query("SELECT `ft_forum_id`,`ft_name`,`ft_posts`,`ft_id`,`ft_locked` FROM `forum_topics` WHERE `ft_id`='{$_GET['viewtopic']}'");
    if ( $db->num_rows($q) == 0 ) {
  echo 'Topic doesn\'t exist.<br />&gt <a href="'.gen_url('forums',true).'" alt="Go Back" title="Go Back">Go Back</a>';
  die($h->endpage());
    }
$topic = $db->fetch_row($q);
$q2 = $db->query("SELECT `ff_auth`,`ff_owner`,`ff_id`,`ff_name` FROM `forum_forums` WHERE `ff_id` = {$topic['ft_forum_id']}");
    if ( $db->num_rows($q2) == 0 ) {
  echo 'Forum doesn\'t exist.<br />&gt <a href="'.gen_url('forums',true).'" alt="Go Back" title="Go Back">Go Back</a>';
  die($h->endpage());
    }
$forum = $db->fetch_row($q2);
         if ( ($forum['ff_auth']=='gang' AND $ir['gang'] != $forum['ff_owner'] and $ir["user_level"] < 2) OR ($forum['ff_auth'] == 'staff' AND $ir['user_level'] < 2) ) {
  echo '
You have no permission to view this forum.<br />
> <a href="'.gen_url('forums',true).'">Back</a>
  ';
  die($h->endpage());
         }
echo "<big><a href='".gen_url('forums',true)."'>Forums Home</a> >> <a href='".gen_url('forums',true)."&viewforum={$forum['ff_id']}'>{$forum['ff_name']}</a> >> <a href='".gen_url('forums',true)."&viewtopic={$_GET['viewtopic']}'>{$topic['ft_name']}</a></big><br /><br />";
	$posts_per_page = 20;
	$posts_topic = $topic['ft_posts'];
	$pages = ceil($posts_topic/$posts_per_page);
	//$st = ($_GET['st']) ? $_GET['st'] : 0;
       $st = ( isset($_GET['st'])&&is_numeric($_GET['st']) )?abs(intval($_GET['st'])):0;
   if ( isset($_GET['lastpost']) ) {
$st = ($pages-1)*20;
   }
	$pst =- 20;
echo "Pages: ";
		for ( $i=1;$i<=$pages;$i++ ) {
	$pst += 20;
echo "<a href='".gen_url('forums',true)."&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 ( $ir['user_level'] > 1 ) {
echo "
<form action='".gen_url('forums',true)."&act=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='".gen_url('forums',true)."&act=pin&topic={$_GET['viewtopic']}''><img src='sticky.jpg' alt='Pin/Unpin Topic' title='Pin/Unpin Topic' /></a>
<a href='".gen_url('forums',true)."&act=lock&topic={$_GET['viewtopic']}''><img src='lock.jpg' alt='Lock/Unlock Topic' title='Lock/Unlock Topic' /></a>
<a href='".gen_url('forums',true)."&act=deletopic&topic={$_GET['viewtopic']}''><img src='delete.gif' alt='Delete Topic' title='Delete Topic' /></a><br />
";
}
echo "
<table cellspacing='1' class='table' width='100%' border='0'>\n";
$q3 = $db->query("SELECT `fp_poster_name`,`fp_editor_time`,`fp_editor_name`,`fp_editor_id`,`fp_edit_count`,`fp_time`,`fp_id`,`fp_poster_id`,`fp_text`,`fp_subject` FROM `forum_posts` WHERE `fp_topic_id` = {$topic['ft_id']} ORDER BY `fp_time` ASC LIMIT $st, 20");
	$no = $st;
while ( $r = $db->fetch_row($q3) ) {
	$qlink = "[<a href='".gen_url('forums',true)."&act=quote&viewtopic={$_GET['viewtopic']}&quotename=". strip_tags($r['fp_poster_name']). "&quotetext=".urlencode($r['fp_text']). "'>Quote Post</a>]";
  if ( $ir['user_level'] > 1 || $ir['userid']==$r['fp_poster_id'] ) {
$elink = "[<a href='".gen_url('forums',true)."&act=edit&post={$r['fp_id']}&topic={$_GET['viewtopic']}'>Edit Post</a>]";
  } else {
$elink = "";
  }
	$no++;
   if ( $no > 1 and $ir['user_level'] > 1 ) {
	$dlink="[<a href='".gen_url('forums',true)."&act=delepost&post={$r['fp_id']}'>Delete Post</a>]";
   } else {
	$dlink = "";
   }
	$t = date('F j Y, g:i:s a',$r['fp_time']);
     if ( $r['fp_edit_count'] > 0 ) {
	$edittext = "\n<br /><i>Last edited by <a href='".gen_url('viewuser',true)."&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 = $db->query("SELECT `userid`,`posts`,`forums_avatar`,`forums_signature`,`level` FROM `users` WHERE `userid` = {$r['fp_poster_id']}");
$memb = $db->fetch_row($membq);
	$precache[$memb['userid']]=$memb;
   } else {
	$memb = $precache[$r['fp_poster_id']];
   }
	$rank = forums_rank($memb['posts']);
	$av = ($memb['forums_avatar'])?'<img src="'.$memb['forums_avatar'].'" width="150px" height="150px" />':'<img src="noav.gif" />';
	$memb['forums_signature'] = ($memb['forums_signature'])?$bbc->bbcode_parse($memb['forums_signature']):'No Signature';
	$r['fp_text']=$bbc->bbcode_parse($r['fp_text']);
echo "<tr>
<th align='center'>Post #{$no}</th> <th align='center'>Subject: {$r['fp_subject']}<br />
Posted at: $t $qlink$elink$dlink</th>
</tr>
<tr>
<td valign=top><a href='".gen_url('viewuser',true)."&u={$r['fp_poster_id']}'>{$r['fp_poster_name']}</a> [{$r['fp_poster_id']}]<br />
$av<br />
$rank<br />
Level: {$memb['level']}</td>
<td valign=top>{$r['fp_text']}
{$edittext}<br />
-------------------<br />
{$memb['forums_signature']}</td>
</tr>";
}
echo "</table>";
	$pst =- 20;
  echo "Pages: ";
           for ( $i=1;$i<=$pages;$i++ ) {
	$pst += 20;
  echo "<a href='".gen_url('forums',true)."&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 />
<b>Post a reply to this topic:</b><br />
<form action='".gen_url('forums',true)."&reply={$topic['ft_id']}' method='post'>
<table cellspacing='1' class='table' width='80%' border='0'>
<tr>
<td align='right'>Subject:</td>
<td align='left'><input type='text' name='fp_subject' /></td>
</tr>
<tr>
<td align='right'>Post:</td>
<td align='left'><textarea rows='7' cols='40' name='fp_text'></textarea></td>
</tr>
<tr>
<th colspan='2'><input type='submit' value='Post Reply'></th>
</tr>
</table>
</form>
  ";
    } else {
echo "<br /><br />
<i>This topic has been locked, you cannot reply to it.</i>";
    }
         }

 

Please help me with this errors ... i will give more details if necessary

thanks! :o

Link to comment
Share on other sites

Hi there,

PHP 5.3 and up, which you are using, have error reporting on by default. You can read more about that at php.net.

It's really nothing to worry about for you, it's just a few things in the code that isn't strictly on standards.

You can turn it off, but there are several ways of doing so. So let me ask you rather, are you on/with a host, or are you running a test version on you own PC?

Because if you are on/with a host, you can ask their support team just to lower the "error_reporting" value.

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...