Jump to content

Recommended Posts

I have tried to echo and everything, I cant get these tables to work with the php inside!

 

Its a profile page for my game!  :-[

 

<?php
$_SESSION['lovetap'] = 0;
include "globals.php";
$_GET['u'] = abs((int) $_GET['u']);
if(!$_GET['u'])
{
print "Invalid use of file";
}
else
{
$q=$db->query("SELECT u.*,us.*,c.*,h.*,g.*,f.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid 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 WHERE u.userid={$_GET['u']}");
if($db->num_rows($q) == 0)
{
print "Sorry, we could not find a user with that ID, check your source.";
}
else
{
$r=$db->fetch_row($q);
if($r['user_level'] == 1) { $userl="Member"; } else if($r['user_level'] == 2) { $userl="Admin"; } else if ($r['user_level'] == 3) { $userl="GM"; } else if($r['user_level'] == 0) { $userl="NPC"; }  else {$userl="FM"; }
$lon=($r['laston'] > 0) ?date('F j, Y g:i:s a',$r['laston']) : "Never";
$sup=date('F j, Y g:i:s a',$r['signedup']);
$ts=$r['strength']+$r['agility']+$r['guard']+$r['labour']+$r['IQ'];
$d="";
if($r['laston'] > 0)
{
$la=time()-$r['laston'];
$unit="seconds";
if($la >= 60)
{
$la=(int) ($la/60);
$unit="minutes";
}
if($la >= 60)
{
$la=(int) ($la/60);
$unit="hours";
if($la >= 24)
{
$la=(int) ($la/24);
$unit="days";
}
}
$str="$la $unit ago";
}
else
{
  $str="--";
}
if($r['last_login'] > 0)
{
$ll=time()-$r['last_login'];
$unit2="seconds";
if($ll >= 60)
{
$ll=(int) ($ll/60);
$unit2="minutes";
}
if($ll >= 60)
{
$ll=(int) ($ll/60);
$unit2="hours";
if($ll >= 24)
{
$ll=(int) ($ll/24);
$unit2="days";
}
}
$str2="$ll $unit2 ago";
}
else
{
  $str2="--";
}
if($r['donatordays'] > 0)
{
if($r['race'] == "Pirate")
{
	$color = "<font color='red'>";
	$ecolor = "</font>";
	$ccode = "<a alt='Elite Pirate: {$r['donatordays']} Days Left' title='Elite Pirate: {$r['donatordays']} Days Left'>";
	$cend = "</a>";
}
else if($r['race'] == "Ninja")
{
	$color = "<font color='blue'>";
	$ecolor = "</font>";
	$ccode = "<a alt='Stealth Ninja: {$r['donatordays']} Days Left' title='Stealth Ninja: {$r['donatordays']} Days Left'>";
	$cend = "</a>";
}
}
else
{
if($r['race'] == "Pirate")
{
	$color = "<font color='light yellow'>";
	$ecolor = "</font>";
	$ccode = "";
	$cend = "";
}
else if($r['race'] == "Ninja")
{
	$color = "<font color='white'>";
	$ecolor = "</font>";
	$ccode = "";
	$cend = "";
}
}

require "bb.php";

$bbc = new bbcode;
$buser = $db->query("SELECT * FROM profile_signature WHERE userid = {$r['userid']}");
$buserq = $db->fetch_row($buser);
if($buserq['signature']) $view_signature = $bbc->bbcode_parse($buserq['signature']);
else $view_signature = "No Signature!";

if($r['laston'] >= time()-15*60) { $on="<font color=green><b>[Online]</b></font>"; } else { $on="<font color=red><b>[Offline]</b></font>"; }


<table width='100%'>
<td class=contentcontent width='25%' valign='top'>
if($r['display_pic'])
{
print "<img src='{$r['display_pic']}' alt='User Display Pic' title='User Display Pic' />";
}
else
{
print "This user has no display pic!";
}</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Name:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
$ccode$color{$r['username']}$ecolor$cend</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Health:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
{$r['hp']}/{$r['maxhp']}</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Type:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
$userl</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Race:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
{$r['race']}</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Gender:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
{$r['gender']}</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Fourm Posts:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
{$r['posts']}</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Level:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
{$r['level']}</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Money:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
\${$r['money']}</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Age:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
{$r['daysold']}</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Last Active:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
$str</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Online:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
$on</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Gang:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
";
if($r['gang'])
{
print "<a href='gangs.php?action=view&ID={$r['gang']}'>{$r['gangNAME']}</a>";
}
else
{
print "N/A";
}</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
City:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
{$r['cityname']}</td>
</td>
<td class=contentcontent width='20%' valign='top'>
House:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
{$r['hNAME']}</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Hospital Status:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
if($r['hospital'])
{
print "<font color=red>{$r['hospital']} minutes.</font>";
}
else
{
print "Not in Hospital";
}</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Prison Status:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
if($r['jail'])
{
print "<font color=red>{$r['jail']} minutes.</font>";
}
else
{
print "Not in Prison";
}</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Referals:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
";
$rr=$db->query("SELECT * FROM referals WHERE refREFER={$r['userid']}");
print $db->num_rows($rr);
print "</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Friends:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
{$r['friend_count']}</td>
</td>
</td></table>
<br<br><br>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
print "[<a href='mailbox.php?action=compose&ID={$r['userid']}'>Send Mail</a>]";</td>
</td>
        <td class=contentcontent width='20%' valign='top'>
print "[<a href='sendcash.php?ID={$r['userid']}'>Send Cash</a>]";</td>
</td>
<td class=contentcontent width='20%' valign='top'>
if($set['sendcrys_on'])
{
print "[<a href='sendcrys.php?ID={$r['userid']}'>Send Points</a>]";
}</td>
</td>
<td class=contentcontent width='20%' valign='top'>
if($set['sendbank_on'])
{
if($ir['bankmoney'] >= 0 && $r['bankmoney'] >= 0)
{
print "[<a href='sendbank.php?ID={$r['userid']}'>Bank Xfer</a>]";
}</td>
</td>
<td class=contentcontent width='20%' valign='top'>
if($ir['cybermoney'] >= 0 && $r['cybermoney'] >= 0)
{
print "[<a href='sendcyber.php?ID={$r['userid']}'>CyberBank Xfer</a>]<br /><br />";
}
}</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
print "
[<a href='attack.php?ID={$r['userid']}'>Attack</a>]";</td>
</td>
        <td class=contentcontent width='20%' valign='top'>
print "[<a href='contactlist.php?action=add&ID={$r['userid']}'>Add Contact</a>]";</td>
</td>
<td class=contentcontent width='20%' valign='top'>
if($ir['donatordays'] > 0)
{
print "
[<a href='friendslist.php?action=add&ID={$r['userid']}'>Add Friends</a>]";
}</td>
</td>
<td class=contentcontent width='20%' valign='top'>
if($ir['donatordays'] > 0)
{
print "
[<a href='blacklist.php?action=add&ID={$r['userid']}'>Add Enemies</a>]";
}</td>
</td>
<td class=contentcontent width='20%' valign='top'>
</td>
</td>
</td></table>";
<br><br>
<table width='100%'>
<td class=contentcontent width='30%' valign='top'>
if($ir['user_level'] == 2 || $ir['user_level'] == 3 || $ir['user_level'] == 5)
{
print "<br /><br />
[<a href='jailuser.php?userid={$r['userid']}'>Jail</a>]<br /><br />
[<a href='mailban.php?userid={$r['userid']}'>MailBan</a>]";
}</td>
</td>
        <td class=contentcontent width='70%' valign='top'>
if($ir['user_level'] == 2 || $ir['user_level'] == 3 || $ir['user_level'] == 5)
{
  $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']);
print "<h3>Internet Info</h3><table width='100%' border='0' cellspacing='1' class='table'>
<tr><td></td><td class='h'>IP</td><td class='h'>Hostname</td></tr>
<tr><td class='h'>Last Hit</td><td>$r[lastip]</td><td>$r[lastiph]</td></tr>
<tr><td class='h'>Last Login</td><td>$r[lastip_login]</td><td>$r[lastip_loginh]</td></tr>
<tr><td class='h'>Signup</td><td>$r[lastip_signup]</td><td>$r[lastip_signuph]</td></tr></table>";
print "<form action='staffnotes.php' method='post'>
Staff Notes: <br />
<textarea rows=7 cols=40 name='staffnotes'>{$r['staffnotes']}</textarea>
<br /><input type='hidden' name='ID' value='{$_GET['u']}' />
<input type='submit' value='Change' /></form>";
}
else
{
print " ";
}</td>
</td>
</td></table><br><br>
<table width='100%'>
<td align=center colspan=3>SIGNATURE</td></tr>
<tr>
<td colspan=3>$view_signature</td>
</tr>
</table>";
}
}
function checkblank($in)
{
  if(!$in) { return "N/A"; }
  return $in;
}
$h->endpage();
?>

Link to comment
https://forums.phpfreaks.com/topic/178904-so-lost-with-these-errors/
Share on other sites

Syntax errors are simply caused by poor coding, there not really the kind of thing you should need help with. Find the errors and fix them.

 

Your code is not indented properly and therefore very difficult to read, so its not likely someone here is going to do your work for you.

I gave all the information so people can help. I said its a syntax error, its because theres HTML in the PHP script. It give me an error at the start of the tables. So its all the tables giving the error. I just need know how I would format the tables to work in the PHP set up. Here is the beginning area of the tables that are throwing the code:

 

<table width='100%'>
   <td class=contentcontent width='25%' valign='top'>
   if($r['display_pic'])
{
print "<img src='{$r['display_pic']}' alt='User Display Pic' title='User Display Pic' />";
}
else
{
print "This user has no display pic!";
}</td>
   </td>
   </td></table>
<table width='100%'>
   <td class=contentcontent width='20%' valign='top'>
   Name:</td>
   </td>
        <td class=contentcontent width='30%' valign='top'>
   $ccode$color{$r['username']}$ecolor$cend</td>
   </td>
   <td class=contentcontent width='20%' valign='top'>
   Health:</td>
   </td>
   <td class=contentcontent width='30%' valign='top'>
   {$r['hp']}/{$r['maxhp']}</td>
   </td>
   </td></table>

Ok, there two ways. You can either exit in and out of php. eg;

 

<?php
// some php logic
?>
<table width='100%'>
<?php
// some more php logic
?>

 

Or you can use php's echo construct to output the html.

 

 

<?php
// some php logic

echo "<table width='100%'>";

// some more php logic
?>

I did what you said and I still get :

 

Parse error: syntax error, unexpected T_VARIABLE

 

So I took that part out and still got this error:

 

syntax error, unexpected '}'  on line 148

 

This is what I did to the page like you said...

 

<?php
$_SESSION['lovetap'] = 0;
include "globals.php";
$_GET['u'] = abs((int) $_GET['u']);
if(!$_GET['u'])
{
print "Invalid use of file";
}
else
{
$q=$db->query("SELECT u.*,us.*,c.*,h.*,g.*,f.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid 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 WHERE u.userid={$_GET['u']}");
if($db->num_rows($q) == 0)
{
print "Sorry, we could not find a user with that ID, check your source.";
}
else
{
$r=$db->fetch_row($q);
if($r['user_level'] == 1) { $userl="Member"; } else if($r['user_level'] == 2) { $userl="Admin"; } else if ($r['user_level'] == 3) { $userl="GM"; } else if($r['user_level'] == 0) { $userl="NPC"; }  else {$userl="FM"; }
$lon=($r['laston'] > 0) ?date('F j, Y g:i:s a',$r['laston']) : "Never";
$sup=date('F j, Y g:i:s a',$r['signedup']);
$ts=$r['strength']+$r['agility']+$r['guard']+$r['labour']+$r['IQ'];
$d="";
if($r['laston'] > 0)
{
$la=time()-$r['laston'];
$unit="seconds";
if($la >= 60)
{
$la=(int) ($la/60);
$unit="minutes";
}
if($la >= 60)
{
$la=(int) ($la/60);
$unit="hours";
if($la >= 24)
{
$la=(int) ($la/24);
$unit="days";
}
}
$str="$la $unit ago";
}
else
{
  $str="--";
}
if($r['last_login'] > 0)
{
$ll=time()-$r['last_login'];
$unit2="seconds";
if($ll >= 60)
{
$ll=(int) ($ll/60);
$unit2="minutes";
}
if($ll >= 60)
{
$ll=(int) ($ll/60);
$unit2="hours";
if($ll >= 24)
{
$ll=(int) ($ll/24);
$unit2="days";
}
}
$str2="$ll $unit2 ago";
}
else
{
  $str2="--";
}
if($r['donatordays'] > 0)
{
if($r['race'] == "Pirate")
{
	$color = "<font color='red'>";
	$ecolor = "</font>";
	$ccode = "<a alt='Elite Pirate: {$r['donatordays']} Days Left' title='Elite Pirate: {$r['donatordays']} Days Left'>";
	$cend = "</a>";
}
else if($r['race'] == "Ninja")
{
	$color = "<font color='blue'>";
	$ecolor = "</font>";
	$ccode = "<a alt='Stealth Ninja: {$r['donatordays']} Days Left' title='Stealth Ninja: {$r['donatordays']} Days Left'>";
	$cend = "</a>";
}
}
else
{
if($r['race'] == "Pirate")
{
	$color = "<font color='light yellow'>";
	$ecolor = "</font>";
	$ccode = "";
	$cend = "";
}
else if($r['race'] == "Ninja")
{
	$color = "<font color='white'>";
	$ecolor = "</font>";
	$ccode = "";
	$cend = "";
}
}

require "bb.php";

$bbc = new bbcode;
$buser = $db->query("SELECT * FROM profile_signature WHERE userid = {$r['userid']}");
$buserq = $db->fetch_row($buser);
if($buserq['signature']) $view_signature = $bbc->bbcode_parse($buserq['signature']);
else $view_signature = "No Signature!";

if($r['laston'] >= time()-15*60) { $on="<font color=green><b>[Online]</b></font>"; } else { $on="<font color=red><b>[Offline]</b></font>"; }

?>
<table width='100%'>
<td class=contentcontent width='25%' valign='top'>
<?php
if($r['display_pic'])
{
print "<img src='{$r['display_pic']}' alt='User Display Pic' title='User Display Pic' />";
}
else
{
print "This user has no display pic!";
}
?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Name:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
<?php
$ccode$color{$r['username']}$ecolor$cend
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Health:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
<?php
{$r['hp']}/{$r['maxhp']}
?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Type:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
<?php
$userl
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Race:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
<?php
{$r['race']}
?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Gender:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
<?php
{$r['gender']}
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Fourm Posts:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
<?php
{$r['posts']}
?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Level:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
<?php
{$r['level']}
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Money:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
<?php
\${$r['money']}
?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Age:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
<?php
{$r['daysold']}
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Last Active:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
<?php
$str
?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Online:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
<?php
$on
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Gang:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
<?php
if($r['gang'])
{
print "<a href='gangs.php?action=view&ID={$r['gang']}'>{$r['gangNAME']}</a>";
}
else
{
print "N/A";
}
?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
City:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
<?php
{$r['cityname']}
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
House:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
<?php
{$r['hNAME']}
?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Hospital Status:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
<?php
if($r['hospital'])
{
print "<font color=red>{$r['hospital']} minutes.</font>";
}
else
{
print "Not in Hospital";
}
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Prison Status:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
<?php
if($r['jail'])
{
print "<font color=red>{$r['jail']} minutes.</font>";
}
else
{
print "Not in Prison";
}
?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Referals:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
<?php
$rr=$db->query("SELECT * FROM referals WHERE refREFER={$r['userid']}");
print $db->num_rows($rr);
print "
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Friends:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
<?php
{$r['friend_count']}
?>
</td>
</td>
</td></table>
<br<br><br>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
<?php
print "[<a href='mailbox.php?action=compose&ID={$r['userid']}'>Send Mail</a>]";
?>
</td>
</td>
        <td class=contentcontent width='20%' valign='top'>
<?php
print "[<a href='sendcash.php?ID={$r['userid']}'>Send Cash</a>]";
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
<?php
if($set['sendcrys_on'])
{
print "[<a href='sendcrys.php?ID={$r['userid']}'>Send Points</a>]";
}
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
<?php
if($set['sendbank_on'])
{
if($ir['bankmoney'] >= 0 && $r['bankmoney'] >= 0)
{
print "[<a href='sendbank.php?ID={$r['userid']}'>Bank Xfer</a>]";
}
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
<?php
if($ir['cybermoney'] >= 0 && $r['cybermoney'] >= 0)
{
print "[<a href='sendcyber.php?ID={$r['userid']}'>CyberBank Xfer</a>]<br /><br />";
}
}
?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
<?php
print "
[<a href='attack.php?ID={$r['userid']}'>Attack</a>]";
?>
</td>
</td>
        <td class=contentcontent width='20%' valign='top'>
<?php
print "[<a href='contactlist.php?action=add&ID={$r['userid']}'>Add Contact</a>]";
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
<?php
if($ir['donatordays'] > 0)
{
print "
[<a href='friendslist.php?action=add&ID={$r['userid']}'>Add Friends</a>]";
}
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
<?php
if($ir['donatordays'] > 0)
{
print "
[<a href='blacklist.php?action=add&ID={$r['userid']}'>Add Enemies</a>]";
}
?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
</td>
</td>
</td></table>";
<br><br>
<table width='100%'>
<td class=contentcontent width='30%' valign='top'>
<?php
if($ir['user_level'] == 2 || $ir['user_level'] == 3 || $ir['user_level'] == 5)
{
print "<br /><br />
[<a href='jailuser.php?userid={$r['userid']}'>Jail</a>]<br /><br />
[<a href='mailban.php?userid={$r['userid']}'>MailBan</a>]";
}
?>
</td>
</td>
        <td class=contentcontent width='70%' valign='top'>
<?php
if($ir['user_level'] == 2 || $ir['user_level'] == 3 || $ir['user_level'] == 5)
{
  $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']);
print "<h3>Internet Info</h3><table width='100%' border='0' cellspacing='1' class='table'>
<tr><td></td><td class='h'>IP</td><td class='h'>Hostname</td></tr>
<tr><td class='h'>Last Hit</td><td>$r[lastip]</td><td>$r[lastiph]</td></tr>
<tr><td class='h'>Last Login</td><td>$r[lastip_login]</td><td>$r[lastip_loginh]</td></tr>
<tr><td class='h'>Signup</td><td>$r[lastip_signup]</td><td>$r[lastip_signuph]</td></tr></table>";
print "<form action='staffnotes.php' method='post'>
Staff Notes: <br />
<textarea rows=7 cols=40 name='staffnotes'>{$r['staffnotes']}</textarea>
<br /><input type='hidden' name='ID' value='{$_GET['u']}' />
<input type='submit' value='Change' /></form>";
}
else
{
print " ";
}
?>
</td>
</td>
</td></table><br><br>
<table width='100%'>
<td align=center colspan=3>SIGNATURE</td></tr>
<tr>
<td colspan=3>$view_signature</td>
</tr>
</table>";
}
}
<?php
function checkblank($in)
{
  if(!$in) { return "N/A"; }
  return $in;
}
$h->endpage();
?>

Hi

 

Quick go through reformatting it for you.

 

<?php
$_SESSION['lovetap'] = 0;
include "globals.php";
$_GET['u'] = abs((int) $_GET['u']);
if(!$_GET['u'])
{
print "Invalid use of file";
}
else
{
$q=$db->query("SELECT u.*,us.*,c.*,h.*,g.*,f.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid 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 WHERE u.userid=".$_GET['u']."");
if($db->num_rows($q) == 0)
{
	print "Sorry, we could not find a user with that ID, check your source.";
}
else
{
	$r=$db->fetch_row($q);
	if($r['user_level'] == 1) 
	{
		$userl="Member"; 
	} 
	else if($r['user_level'] == 2) 
	{ 
		$userl="Admin"; 
	} 
	else if ($r['user_level'] == 3) 
	{ 
		$userl="GM"; 
	} 
	else if($r['user_level'] == 0) 
	{ 
		$userl="NPC"; 
	}  
	else 
	{
		$userl="FM"; 
	}
	$lon=($r['laston'] > 0) ?date('F j, Y g:i:s a',$r['laston']) : "Never";
	$sup=date('F j, Y g:i:s a',$r['signedup']);
	$ts=$r['strength']+$r['agility']+$r['guard']+$r['labour']+$r['IQ'];
	$d="";
	if($r['laston'] > 0)
	{
		$la=time()-$r['laston'];
		$unit="seconds";
		if($la >= 60)
		{
			$la=(int) ($la/60);
			$unit="minutes";
		}
		if($la >= 60)
		{
			$la=(int) ($la/60);
			$unit="hours";
			if($la >= 24)
			{
				$la=(int) ($la/24);
				$unit="days";
			}
		}
		$str="$la $unit ago";
	}
	else
	{
		$str="--";
	}
	if($r['last_login'] > 0)
	{
		$ll=time()-$r['last_login'];
		$unit2="seconds";
		if($ll >= 60)
		{
			$ll=(int) ($ll/60);
			$unit2="minutes";
		}
		if($ll >= 60)
		{
			$ll=(int) ($ll/60);
			$unit2="hours";
			if($ll >= 24)
			{
				$ll=(int) ($ll/24);
				$unit2="days";
			}
		}
		$str2="$ll $unit2 ago";
	}
	else
	{
		$str2="--";
	}
	if($r['donatordays'] > 0)
	{
		if($r['race'] == "Pirate")
		{
			$color = "<font color='red'>";
			$ecolor = "</font>";
			$ccode = "<a alt='Elite Pirate: ".$r['donatordays']." Days Left' title='Elite Pirate: ".$r['donatordays']." Days Left'>";
			$cend = "</a>";
		}
		else if($r['race'] == "Ninja")
		{
			$color = "<font color='blue'>";
			$ecolor = "</font>";
			$ccode = "<a alt='Stealth Ninja: ".$r['donatordays']." Days Left' title='Stealth Ninja: ".$r['donatordays']." Days Left'>";
			$cend = "</a>";
		}
	}
	else
	{
		if($r['race'] == "Pirate")
		{
			$color = "<font color='light yellow'>";
			$ecolor = "</font>";
			$ccode = "";
			$cend = "";
		}
		else if($r['race'] == "Ninja")
		{
			$color = "<font color='white'>";
			$ecolor = "</font>";
			$ccode = "";
			$cend = "";
		}
	}

	require "bb.php";

	$bbc = new bbcode;
	$buser = $db->query("SELECT * FROM profile_signature WHERE userid = {$r['userid']}");
	$buserq = $db->fetch_row($buser);
	if($buserq['signature']) 
		$view_signature = $bbc->bbcode_parse($buserq['signature']);
	else 
		$view_signature = "No Signature!";

	if($r['laston'] >= time()-15*60) 
	{ 
		$on="<font color=green><b>[Online]</b></font>"; 
	} 
	else 
	{ 
		$on="<font color=red><b>[Offline]</b></font>"; 
	}

?>
<table width='100%'>
<td class=contentcontent width='25%' valign='top'>
	<?php
	if($r['display_pic'])
	{
		print "<img src='{$r['display_pic']}' alt='User Display Pic' title='User Display Pic' />";
	}
	else
	{
		print "This user has no display pic!";
	}
	?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Name:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
	<?php
	echo $ccode . $color . $r['username'] . $ecolor . $cend;
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Health:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
	<?php
	echo $r['hp']/$r['maxhp'];
	?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Type:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
	<?php
	echo $userl;
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Race:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
	<?php
	echo $r['race'];
	?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Gender:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
	<?php
	echo $r['gender'];
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Fourm Posts:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
	<?php
	echo $r['posts'];
	?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Level:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
	<?php
	echo $r['level'];
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Money:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
	<?php
	echo $r['money'];
	?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Age:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
	<?php
	echo $r['daysold'];
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Last Active:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
	<?php
	echo $str;
	?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Online:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
	<?php
	echo $on;
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Gang:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
	<?php
	if($r['gang'])
	{
		print "<a href='gangs.php?action=view&ID=".$r['gang']."'>".$r['gangNAME']."</a>";
	}
	else
	{
		print "N/A";
	}
	?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
City:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
	<?php
	echo $r['cityname'];
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
House:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
	<?php
	echo $r['hNAME'];
	?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Hospital Status:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
	<?php
	if($r['hospital'])
	{
		print "<font color=red>".$r['hospital']." minutes.</font>";
	}
	else
	{
		print "Not in Hospital";
	}
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Prison Status:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
	<?php
	if($r['jail'])
	{
		print "<font color=red>".$r['jail']." minutes.</font>";
	}
	else
	{
		print "Not in Prison";
	}
	?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
Referals:</td>
</td>
        <td class=contentcontent width='30%' valign='top'>
	<?php
	$rr=$db->query("SELECT * FROM referals WHERE refREFER={$r['userid']}");
	print $db->num_rows($rr);
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
Friends:</td>
</td>
<td class=contentcontent width='30%' valign='top'>
	<?php
	echo $r['friend_count'];
	?>
</td>
</td>
</td></table>
<br<br><br>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
	<?php
	print "<a href='mailbox.php?action=compose&ID=".$r['userid']."'>Send Mail</a>";
	?>
</td>
</td>
        <td class=contentcontent width='20%' valign='top'>
	<?php
	print "<a href='sendcash.php?ID=".$r['userid']."'>Send Cash</a>";
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
	<?php
	if($set['sendcrys_on'])
	{
		print "<a href='sendcrys.php?ID=".$r['userid']."'>Send Points</a>";
	}
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
	<?php
	if($set['sendbank_on'])
	{
		if($ir['bankmoney'] >= 0 && $r['bankmoney'] >= 0)
		{
			print "<a href='sendbank.php?ID=".$r['userid']."'>Bank Xfer</a>";
		}
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
	<?php
		if($ir['cybermoney'] >= 0 && $r['cybermoney'] >= 0)
		{
			print "<a href='sendcyber.php?ID=".$r['userid']."'>CyberBank Xfer</a><br /><br />";
		}
	}
	?>
</td>
</td>
</td></table>
<table width='100%'>
<td class=contentcontent width='20%' valign='top'>
	<?php
	print "<a href='attack.php?ID=".$r['userid']."'>Attack</a>]";
	?>
</td>
</td>
        <td class=contentcontent width='20%' valign='top'>
	<?php
	print "[<a href='contactlist.php?action=add&ID=".$r['userid']."'>Add Contact</a>";
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
	<?php
	if($ir['donatordays'] > 0)
	{
		print "<a href='friendslist.php?action=add&ID=".$r['userid']."'>Add Friends</a>";
	}
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
	<?php
	if($ir['donatordays'] > 0)
	{
		print "<a href='blacklist.php?action=add&ID=".$r['userid']."'>Add Enemies</a>";
	}
	?>
</td>
</td>
<td class=contentcontent width='20%' valign='top'>
</td>
</td>
</td></table>
<br><br>
<table width='100%'>
<td class=contentcontent width='30%' valign='top'>
	<?php
	if($ir['user_level'] == 2 || $ir['user_level'] == 3 || $ir['user_level'] == 5)
	{
		print "<br /><br />
		<a href='jailuser.php?userid=".$r['userid']."'>Jail</a>]<br /><br />
		<a href='mailban.php?userid=".$r['userid']."'>MailBan</a>";
	}
	?>
</td>
</td>
        <td class=contentcontent width='70%' valign='top'>
	<?php
	if($ir['user_level'] == 2 || $ir['user_level'] == 3 || $ir['user_level'] == 5)
	{
		$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']);
		print "<h3>Internet Info</h3><table width='100%' border='0' cellspacing='1' class='table'>
		<tr><td></td><td class='h'>IP</td><td class='h'>Hostname</td></tr>
		<tr><td class='h'>Last Hit</td><td>".$r['lastip']."</td><td>".$r['astiph']."</td></tr>
		<tr><td class='h'>Last Login</td><td>".$r['lastip_login']."</td><td>".$r['lastip_loginh']."</td></tr>
		<tr><td class='h'>Signup</td><td>".$r['lastip_signup']."</td><td>".$r['lastip_signuph']."</td></tr></table>";
		print "<form action='staffnotes.php' method='post'>
		Staff Notes: <br />
		<textarea rows=7 cols=40 name='staffnotes'>".$r['staffnotes']."</textarea>
		<br /><input type='hidden' name='ID' value='".$_GET['u']."' />
		<input type='submit' value='Change' /></form>";
	}
	else
	{
		print " ";
	}
	?>
</td>
</td>
</td></table><br><br>
<table width='100%'>
<td align=center colspan=3>SIGNATURE</td></tr>
<tr>
<td colspan=3><?php echo $view_signature?></td>
</tr>
</table>
<?php
}
}
function checkblank($in)
{
  if(!$in) { return "N/A"; }
  return $in;
}
$h->endpage();
?>

 

Indenting makes life FAR easier when trying to spot where you have made mistakes.

 

Notepad++ is shareware. Download a copy and try it out. It is good, and will make things far easier for you than trying to struggle with plain old notepad. Eg, the syntax highlighting makes it easy to spot where you have forgotten to close a quote and landed up with half your code as a string that is being printed.

 

All the best

 

Keith

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.