Jump to content
MakeWebGames

error in my viewusers.php


Gucci Mane

Recommended Posts

My view users.php

<?php
include_once (DIRNAME(__FILE__) . '/globals.php');

$_GET['u'] = abs(@intval($_GET['u']));
$_GET['to'] = abs(@intval($_GET['to']));
if(!$_GET['u'])
{
  echo 'Invalid use of file';
  $h->endpage();
  exit;
}
else
{
  $Find = $db->query(sprintf("SELECT u.`userid`, u.`username`, u.`level`, u.`money`, u.`crystals`, u.`laston`, u.`lastip`, u.`energy`, u.`will`, u.`maxwill`, u.`brave`, u.`maxbrave`, u.`maxenergy`, u.`hp`, u.`maxhp`, u.`location`, u.`hospital`, u.`jail`, u.`jail_reason`, u.`fedjail`, u.`user_level`, u.`gender`, u.`daysold`, u.`signedup`, u.`gang`, u.`donatordays`, u.`email`, u.`display_pic`, u.`duties`, u.`staffnotes`, u.`hospreason`, u.`lastip_login`, u.`lastip_signup`, u.`last_login`, u.`friend_count`, u.`enemy_count`, c.`cityid`, c.`cityname`, h.`hID`, h.`hNAME`, h.`hWILL`, g.`gangID`, g.`gangNAME`, f.`fed_userid`, f.`fed_days`, f.`fed_jailedby`, f.`fed_reason`, uu.`userid` AS `fed_jailer_id`, uu.`username` AS `fed_jailer` FROM `users` u LEFT JOIN `cities` c ON u.`location` = c.`cityid` LEFT JOIN `houses` h ON u.`maxwill` = h.`hWILL` LEFT JOIN `gangs` g ON g.`gangID` = u.`gang` LEFT JOIN `fedjail` f ON f.`fed_userid` = u.`userid` LEFT JOIN `users` uu ON f.`fed_jailedby` = uu.`userid` WHERE u.`userid` = '%u'", $_GET['u']));

  if(mysql_num_rows($Find) == '0')
  {
     echo 'Sorry, we could not find a user with that ID, check your source.';
     $h->endpage();
     exit;
  }
  else
  {
     $r = $db->fetch_row($Find);

     $CheckUserLevel = array(
        '0' => 'NPC',
        '1' => 'Member',
        '2' => 'Admin/Owner',
        '3' => 'Secretary',
        '4' => 'Moderator',
        '5' => 'Player Enquires'
     );
     $UserLevel = $CheckUserLevel[$r['user_level']];

     $LastOn = ($r['laston'] > '0') ? date('F j, Y g:i:s a',$r['laston']) : "Never";

     $SignedUp = date('F j, Y g:i:s a', $r['signedup']);

     if($r['laston'] > '0')
     {
        $LA = time() - $r['laston'];
        $Unit1 = "Seconds";
        if($LA >= '60')
        {
           $LA = (int) ($LA/'60');
           $Unit1 = "Minutes";
        }
        if($LA >= '60')
        {
           $LA = (int) ($LA/'60');
           $Unit1 = "Hours";
           if($LA >= '24')
           {
              $LA = (int) ($LA/'24');
              $Unit1 = "Days";
           }
        }
        $LastAction = $LA.' '.$Unit1.' ago';
     }
     else
     {
        $LastAction="--";
     }

     $Status = ($r['laston'] >= time()-'15'*'60') ? "<blink><font color='green'>[b]Online[/b]</font></blink>" : "<font color='red'>[b]Offline[/b]</font>";

     $DD = '';
     if($r['donatordays'])
     {
        $r['username'] = '<font color="#8F5C29">'.stripslashes($r['username']).'</font>';
        $DD = '[img=donator.gif]';
     }



     $UGender = ($r['gender'] == "Male") ? "His" : "Her";
     $FGender = ($r['gender'] == "Male") ? "He Is" : "She Is";

     echo sprintf("<h3>Profile for %s </h3>", stripslashes($r['username']));

     if($r['fedjail'])
     {
        echo '[b]';
        echo sprintf("<font color='#FF0000'><h3>You Cannot See %s (%s) Profile While In Federal Jail!</h3></font>", $UGender, stripslashes($r['username']), $FGender);
        echo sprintf("Days In Fed: %s Day(s) Left 
", number_format($r['fed_days']));
        echo sprintf("Reason: %s 
", stripslashes($r['fed_reason']));
        echo sprintf("Jailed By: [url='%s?u=%u']%s[/url]", $_SERVER['PHP_SELF'], @intval($r['fed_jailer_id']), stripslashes($r['fed_jailer']));
        $h->endpage();
        exit;
     }

     echo '
     <table width="98%" border="1" cellspacing="1" class="table">
        <tr>';
           echo sprintf("<th width='50%%'>%s General Info</th>", $UGender);
           echo sprintf("<th width='50%%'>%s Display Picture</th>", $UGender);
           echo '
        </tr>
        <tr>
           <td>';
              echo sprintf("Name: %s [%s] %s 
", stripslashes($r['username']), $r['userid'], $DD);
              echo sprintf("User Level: %s 
", $UserLevel);
              echo sprintf("Duties: %s 
", stripslashes($r['duties']));
              echo sprintf("Level: %s 
", number_format($r['level']));
              echo sprintf("Cash: %s 
", number_format($r['money']));
              echo sprintf("Crystals: %s 
", number_format($r['crystals']));
              echo sprintf("Property: %s 
", stripslashes($r['hNAME']));
              echo sprintf("Gender: %s 
", $r['gender']);
              Rating: <a href=rating.php?change=up&ID={$r['userid']}><img src=positive.gif></a> {$r['rating']} <a href=rating.php?change=down&ID={$r['userid']}><img src=negative.gif></a>
              echo sprintf("Days Old: %s 
", number_format($r['daysold']));
              echo sprintf("Location: %s ", stripslashes($r['cityname']));
              if($ir['location'] != $r['location'])
              {
                 echo sprintf("[[url='docks.php?to=%u']Travel[/url]]", @intval($r['location']));
              }
              echo ' 
';
              echo sprintf("Friends: %s 
", number_format($r['friend_count']));
              echo sprintf("Enemies: %s 
", number_format($r['enemy_count']));
              echo sprintf("Health: %s/%s 
", number_format($r['hp']), number_format($r['maxhp']));
              echo 'Gang: ';
              if($r['gang'])
              {
                 echo sprintf("[url='crews.php?action=viewgang&ID=%u']%s[/url] 
", @intval($r['gang']), stripslashes($r['gangNAME']));
              }
              else
              {
                 echo 'Not in a gang. 
';
              }
              echo sprintf("Signed Up: %s 
", $SignedUp);
              echo sprintf("Last Action: %s 
", $LastAction);
              echo sprintf("Status: %s 
", $Status);

              if($r['hospital'])
              {
                 echo ' 
';
                 echo sprintf("[b]<font color='#FF000'>In hospital for %s minutes. 
", number_format($r['hospital']));
                 echo sprintf("Reason: %s </font>[/b]", stripslashes($r['hospreason']));
              }

              if($r['jail'])
              {
                 echo ' 
';
                 echo sprintf("[b]<font color='#FF000'>In jail for % minutes. 
", number_format($r['jail']));
                 echo sprintf("Reason: %s </font>[/b]", stripslashes($r['jail_reason']));
              }

              echo '
           </td>
           <td  width="50%" style="text-align:center;">';
           if($r['display_pic'])
           {
              echo sprintf("[img=%s]", $r['display_pic']);
           }
           else
           {
              echo 'This User Doesn\'t Have A Picture Up.';
           }

           echo '
           </td>
        </tr>
        <tr>
           <th colspan="4">Links</th>
        </tr>
        <tr>
           <td colspan="2" style="text-align:center;">
              <table width="100%" cellspacing="0"  border="1">
                 <tr style="font-weight:bold;" align="center">';
                    echo sprintf("<td colspan='4'>[[url='attack.php?ID=%u']Attack[/url]]</td>", @intval($r['userid']));
                    echo '
                 </tr>
                 <tr style="font-weight:bold;" align="center">';
                    echo sprintf("<td width='50%%' colspan='2'>[[url='mailbox.php?action=compose&ID=%u']Send Mail[/url]]</td>", @intval($r['userid']));
                    echo sprintf("<td width='50%%' colspan='2'>[[url='contactlist.php?action=add&ID=%u']Add Contact[/url]]</td>", @intval($r['userid']));
                    echo '
                 </tr>
                 <tr style="font-weight:bold;" align="center">';
                    echo sprintf("<td>[[url='sendcash.php?ID=%u']Send Cash[/url]]</td>", @intval($r['userid']));
                    echo sprintf("<td>[[url='sendrubies.php?ID=%u']Send Crystals[/url]]</td>", @intval($r['userid']));
                    echo sprintf("<td>[[url='sendbank.php?ID=%u']Bank Xfer[/url]]</td>", @intval($r['userid']));
                    echo sprintf("<td>[[url='threat.php?ID={$r[']Issue a Threat[/url]]</td>", @intval($r['userid']));
                    echo sprintf("<td>[[url='sendcyber.php?ID=%u']CyberBank Xfer[/url]]</td>", @intval($r['userid']));
                    echo '
                 </tr>';               
                    if($ir['user_level'] == '2' || $ir['user_level'] == '3' || $ir['user_level'] == '4' || $ir['user_level'] == '5')
                    {
                       echo '
                       <tr style="font-weight:bold;" align="center">';
                          echo sprintf("<td colspan='2'>[[url='jailuser.php?userid=%u']Jail[/url]]</td>", @intval($r['userid']));
                          echo sprintf("<td colspan='2'>[[url='mailban.php?userid=%u']Mail Ban[/url]]</td>", @intval($r['userid']));
                          echo '
                       </tr>';
                    }
                    if($ir['donatordays'] > '0')
                    {
                       echo '
                       <tr style="font-weight:bold;" align="center">';
                          echo sprintf("<td colspan='2'>[[url='friendslist.php?action=add&ID=%u']Add Friends[/url]]</td>", @intval($r['userid']));
                          echo sprintf("<td colspan='2'>[[url='blacklist.php?action=add&ID=%u']Add Enemies[/url]]</td>", @intval($r['userid']));
                          echo '
                       </tr>';
                    }
                    echo '
              </table>
           </td>
        </tr>';

     if($ir['user_level'] == '2' || $ir['user_level'] == '3' || $ir['user_level'] == '4' || $ir['user_level'] == '5')
     {

        function checkblank($in)
        {
           if(!$in)
           {
              return 'N/A';
           }
           return $in;
        }

        echo '
        <tr>';
           echo sprintf("<th colspan='2'>%s Staff Information</th>", $UGender);
           echo '
        </tr>
        <tr>
           <td style="text-align:center;" colspan="2">';

              $r['lastiph'] = @gethostbyaddr($r['lastip']);
              $r['lastiph'] =    checkblank($r['lastiph']);
              $r['lastip_loginh'] = @gethostbyaddr($r['lastip_login']);
              $r['lastip_loginh'] =    checkblank($r['lastip_loginh']);
              $r['lastip_signuph'] = @gethostbyaddr($r['lastip_signup']);
              $r['lastip_signuph'] =    checkblank($r['lastip_signuph']);

              echo '
              <h3>Internet Info</h3>
              <table width="100%" border="1" cellspacing="0" class="table">
                 <tr>
                    <th></th>
                    <th>IP</th>
                    <th>Hostname</th>
                 </tr>
                 <tr>
                    <td>Last Hit</td>';
                    echo sprintf("<td>%s</td>", $r['lastip']);
                    echo sprintf("<td>%s</td>", $r['lastiph']);
                    echo '
                 </tr>
                 <tr>
                    <td>Last Login</td>';
                    echo sprintf("<td>%s</td>", $r['lastip_login']);
                    echo sprintf("<td>%s</td>", $r['lastip_loginh']);
                    echo '
                 </tr>
                 <tr>
                    <td>Signup</td>';
                    echo sprintf("<td>%s</td>", $r['lastip_signup']);
                    echo sprintf("<td>%s</td>", $r['lastip_signuph']);
                    echo '
                 </tr>
              </table>


              <form action="staffnotes.php" method="post">
                 Staff Notes: 
';
                 echo sprintf("<textarea rows='7' cols='60' name='staffnotes'>%s</textarea>", htmlspecialchars(stripslashes($r['staffnotes'])));
                 echo '
';
                 echo sprintf("<input type='hidden' name='ID' value='%u' />", @intval($_GET['u']));
                 echo '
                 <input type="submit" value="Change" />
              </form>
           </td>
        </tr>';
     }
     echo'
     </table>
     ';
  }
}

$h->endpage();
?>

 

The erro I get is Parse error: syntax error, unexpected T_STRING in /home/*****/public_html/viewuser.php on line 110

line 110 is :

<a href=rating.php?change=up&ID={$r['userid']}><img src=positive.gif></a> {$r['rating']} <a href=rating.php?change=down&ID={$r['userid']}><img src=negative.gif></a>
Link to comment
Share on other sites

Replace line 110 with

              echo "Rating: <a href=rating.php?change=up&ID={$r['userid']}><img src=positive.gif></a> {$r['rating']} <a href=rating.php?change=down&ID={$r['userid']}><img src=negative.gif></a>";

 

Honestly you didn't tried enough to fix it, or you still have huge troubles with PHP itself. I would suggest then to try some initial tutorials instead of digging into a code like that.

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