Jump to content
MakeWebGames

my viewuser.php, quick simple fix please.


Recommended Posts

Posted
<?php


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="Mobster"; } else if($r['user_level'] == 2) { $userl="Owner"; } else if ($r['user_level'] == 3) { $userl="Admin"; } else if($r['user_level'] == 0) { $userl="NPC"; }  else {$userl="Moderator"; }

$lon=($r['laston'] > 0) ?date('F j',$r['laston']) : "Never";

$sup=date('j F',$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['user_level'] >1){ $r['username'] = "<font color=red>{$r['username']}</font>";}

elseif($r['donatordays']) { $r['username'] = "<font color=yellow>{$r['username']}</font>";$d="[img=don.gif]"; }



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

if($r['display_pic'])

{

print "<center>[img={$r[]

</center>";

}

else

{

print "<center>[img=http://i38.tinypic.com/29bh8d5.jpg]</center>

";

}

print "<table width=85% cellpadding=3 class='table' border='0'><div align=center>
<tr><td>
[b]Name:[/b] {$r['username']} [{$r['userid']}] $d

</td>
<td>
[b]User Level:[/b] [url='stafflist.php']$userl[/url]

</td></tr>

<tr><td>
[b]Level:[/b] {$r['level']}

</td>
<td>
[b]Health:[/b] {$r['hp']}/{$r['maxhp']}

</td></tr>

<tr><td>
[b]Gender:[/b] {$r['gender']}

</td>
<td>
Ratings: [url='rating.php?ID={$r['][img=thumbsup.gif][/url] [b]{$r['goodratings']}[/b] up, [url='rating.php?ID={$r['][img=thumbsdown.gif][/url][b]{$r['badratings']}[/b] down

</td>
<td>
[b]Age:[/b] {$r['daysold']} Days

</td></tr>

<tr><td>
</td>
<td>
[b]Last Active:[/b] $str

</td></tr>

<tr><td>
[b]Marital Status:[/b] ";

if ($r['marriage'])

{

print "Married to [url='viewuser.php?u={$pr[']{$pr['username']}[/url]";

}

else

{

print "Single";

}
print "
</td></tr>

<tr><td>
[b]Gang:[/b] ";

if($r['gang'])

{

print "[url='gangs.php?action=view&ID={$r[']{$r['gangNAME']}[/url]";

}

else

{

print "None";

}
print "
</td>
<td>
[b]Location:[/b] [url='airport.php']{$r['cityname']}[/url]
</td></tr>

<tr><td>
[b]Money:[/b] \${$r['money']}

</td>
<td>
Property: {$r['hNAME']}

</td></tr>";


$sh=($ir['user_level'] >1) ? "Staff Info" : " ";

print "</td></tr>";



if($r['fedjail'])

{

print "
[b]<font color=brown>This user is in federal jail for {$r['fed_days']} day(s).


{$r['fed_reason']}</font>";

}

if($r['hospital'])

{

print "
[b]<font color=red>This user is in hospital for {$r['hospital']} minutes.
{$r['hospreason']}</font>[/b]
";

}

if($r['jail'])

{

print "
[b]<font color=red>This user is in jail for {$r['jail']} minutes.
{$r['jail_reason']}</font>[/b]</td></tr><tr> <td>
";

}









print "</div></table><table width=85% bgcolor=#202020 cellpadding=3>

<tr><td>
[[url='mailbox.php?action=compose&ID={$r[']Send Mail[/url]]
</td><td>
[[url='sendcash.php?ID={$r[']Send Cash[/url]]
<td>
[[url='sendpoints.php?ID={$r[']Send Points[/url]]
</td><td>
[[url='sendbank.php?ID={$r[']Bank Xfer[/url]]
</td></tr><tr><tr></tr></tr><tr><td>
[[url='sendcyber.php?ID={$r[']CyberBank Xfer[/url]]
</td><td>
[[url='attack.php?ID={$r[']Attack[/url]]
</td><td>
[[url='hackpc.php?ID={$r[']Rob[/url]]
</td><td>
[[url='contactlist.php?action=add&ID={$r[']Add Contact[/url]]
</td></tr><tr>";
{

print "
</tr><tr></tr><tr><td>
[[url='friendslist.php?action=add&ID={$r[']Add Friends[/url]]
</td><td>
[[url='blacklist.php?action=add&ID={$r[']Add Enemies[/url]]
</td>";
print "";
}
if($ir['user_level'] == 2 || $ir['user_level'] == 3 || $ir['user_level'] == 5)

{

print "
<td>
[[url='jailuser.php?userid={$r[']Jail[/url]]
</td><td>
[[url='mailban.php?userid={$r[']MailBan[/url]]
</td></tr>";
}

if($ir['donatordays'] > 0)



print "</table>

";
print"</center>";

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 "<center><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>

[url='staff_punit.php?action=ipform']<u>IP search this user</u>[/url]
";

print "<form action='staffnotes.php' method='post'>

Staff Notes: 


<textarea rows=7 cols=40 name='staffnotes'>{$r['staffnotes']}</textarea>


<input type='hidden' name='ID' value='{$_GET['u']}' />

<input type='submit' value='Change' /></form></center>";

}

else

{

print " ";

}

print "</tr></table>";

}

}

function checkblank($in)

{

 if(!$in) { return "N/A"; }

 return $in;

}


$h->endpage();

?>

 

On my game, when I go to a married user profile it says "Martial Status: Married To" I doesnt say the partners name.

Can you please help me fix this.

Thanks

Posted

Simple problem.

print "Married to {$pr['username']}";

 

The array $pr isn't defined anywhere in that script. Check your mysql tables, let me know if there is a marriage table, and if so what fields hold userid and/or username.

Alternatively, what does $r['marriage'] contain? If it holds the userid of the person the user (who's profile you are on) is married to as I suspect, then changing

 

if ($r['marriage'])

{

print "Married to [url='viewuser.php?u={$pr[']{$pr['username']}[/url]";

}

 

to

 

if ($r['marriage'])

{
$pr=$db->fetch_row($db->query("SELECT username,userid FROM users WHERE userid={$r['marriage']}"));
print "Married to [url='viewuser.php?u={$pr[']{$pr['username']}[/url]";

}

 

Will suffice.

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