Simple code change gives me parse errors

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cindyd
Forum Newbie
Posts: 2
Joined: Sun Jan 25, 2004 11:34 am

Simple code change gives me parse errors

Post by cindyd »

Hi: I have been trying to figure out what is wrong with this hack I am trying to alter (per the original hack) and each time I do, I get a parse error, on lines totally different that what I am changing.

This is the original code:

In showthread.php:

Look for:

Code: Select all

while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) &#123;

  if ($postdone&#1111;$post&#1111;postid]]) &#123;
    $counter--;
    continue;
  &#125; else &#123;
    $postdone&#1111;$post&#1111;postid]]=1;
  &#125;
  $postbits .= getpostbit($post);
&#125;

******replace it with the following:********

while ($post=$DB_site->fetch_array($posts) and $counter++<$perpage) &#123;

  if ($postdone&#1111;$post&#1111;postid]]) &#123;
    $counter--;
    continue;
  &#125; else &#123;
    $postdone&#1111;$post&#1111;postid]]=1;
  &#125;

  $onlinestat = "";
  if(($post&#1111;miserable] == 1) || ($post&#1111;stunned] & 4))&#123;
    if(($bbuserinfo&#1111;usergroupid] == 5) or ($bbuserinfo&#1111;usergroupid] == 6) or ($bbuserinfo&#1111;usergroupid] == 7)) &#123;
      $onlinestat = "$onlinestat<br><font color="red"><b>Miserable User</b></font>";
    &#125;
  &#125;
  $post&#1111;posts]="$post&#1111;posts]$onlinestat";

  $postbits .= getpostbit($post);
&#125;
The above works perfectly, but it also allows moderators to see something I don't want them too. So the instructions were to change this:

Code: Select all

 $onlinestat = ""; 
  if(($post&#1111;miserable] == 1) || ($post&#1111;stunned] & 4))&#123; 
    if(($bbuserinfo&#1111;usergroupid] == 5) or ($bbuserinfo&#1111;usergroupid] == 6) or ($bbuserinfo&#1111;usergroupid] == 7)) &#123; 
      $onlinestat = "$onlinestat<br><font color="red"><b>Miserable User</b></font>"; 
    &#125; 
  &#125;
to this:

Code: Select all

  $onlinestat = ""; 
  if(($post&#1111;miserable] == 1) || ($post&#1111;stunned] & 4))&#123; 
    if($bbuserinfo&#1111;usergroupid] == 6) &#123; 
      $onlinestat = "$onlinestat<br><font color="red"><b>Miserable User</b></font>"; 
    &#125; 
  &#125;
If you need more information I will gladly supply it. I have been going over this for 2 days now. I am not a PHP writer, so if something is wrong
with the change I just don't see it.

Thanks for your help!
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

It might help us to help you if we could see the parse error :)
cindyd
Forum Newbie
Posts: 2
Joined: Sun Jan 25, 2004 11:34 am

Post by cindyd »

Hi:
Parse error: parse error in /home/glassmav/public_html/forum/showthread.php on line 294

Code: Select all

if ($thread&#1111;pollid]) &#123;
  $pollid=$thread&#1111;pollid];
  $pollinfo=$DB_site->query_first("SELECT * FROM poll WHERE pollid='$pollid'");

  $pollinfo&#1111;question]=bbcodeparse($pollinfo&#1111;question],$forum&#1111;forumid],1);

  $splitoptions=explode("|||", $pollinfo&#1111;options]);  ------this is line 294
  $splitvotes=explode("|||",$pollinfo&#1111;votes]);

  $showresults = 0;
  $uservoted = 0;
  $cantvote = 0;
My change doesn't start until around line 450

The parse error changes, I've had at least 3 different ones.
Post Reply