JamesRage Posted December 1, 2012 Posted December 1, 2012 Hey, i've been working on my first mod lately on v2 (a friends copy), what i've been doing is transforming my viewuser around, and everything is going well apart from some issues, when I view the viewuser file from a donator account or if they have a display pic, it comes out perfect (more or less). However, if they don't have a display pic, it comes out very dodgy. Here is the file: <?php include "globals.php"; $_GET['u'] = (isset($_GET['u']) && is_numeric($_GET['u'])) ? abs(intval($_GET['u'])) : ''; if (!$_GET['u']) { echo 'Invalid use of file'; } else { $q = $db->query( "SELECT `userid`, `user_level`, `laston`, `last_login`, `yahoo`, `signedup`, `duties`, `donatordays`, `username`, `gender`, `daysold`, `money`, `rating`, `crystals`, `level`, `friend_count`, `enemy_count`, `display_pic`, `hp`, `name`, `maxhp`, `sm`, `profileSIG`, `gang`, `fedjail`, `hospital`, `hospreason`, `jail`, `jail_reason`, `bankmoney`, `cybermoney`, `lastip`, `last_name`, `age`, `lastip`, `lastip_login`, `lastip_signup`, `staffnotes`, `cityname`, `hNAME`, `gangNAME`, `fed_days`, `fed_reason`, `aim_game`, `msn`, `AIM`, `AOL` FROM `users` `u` INNER JOIN `cities` AS `c` ON `u`.`location` = `c`.`cityid` INNER JOIN `houses` AS `h` ON `u`.`maxwill` = h.`hWILL` LEFT JOIN `gangs` AS `g` ON `g`.`gangID` = `u`.`gang` LEFT JOIN `fedjail` AS `f` ON `f`.`fed_userid` = `u`.`userid` WHERE `u`.`userid` = {$_GET['u']}"); if ($db->num_rows($q) == 0) { $db->free_result($q); echo 'Sorry, we could not find a user with that ID, check your source.'; } else { $r = $db->fetch_row($q); $db->free_result($q); $checkulevel = array(0 => 'NPC', 1 => 'Member', 2 => 'Owner', 3 => 'Secretary', 5 => 'Assistant'); $userl = $checkulevel[$r['user_level']]; $lon = ($r['laston'] > 0) ? date('F j, Y g:i:s a', $r['laston']) : "Never"; $ula = ($r['laston'] == 0) ? 'Never' : DateTime_Parse($r['laston']); $ull = ($r['last_login'] == 0) ? 'Never' : DateTime_Parse($r['last_login']); $sup = date('F j, Y g:i:s a', $r['signedup']); $u_duties = ($r['user_level'] > 1) ? 'Duties: ' . $r['duties'] . '<br />' : ''; $user_name = ($r['donatordays']) ? '<span style="color:red; font-weight:bold;">' . $r['username'] . '</span> [' . $r['userid'] . '] <img src="donator.gif" alt="Donator: ' . $r['donatordays'] . ' Days Left" title="Donator: ' . $r['donatordays'] . ' Days Left" />' : $r['username'] . ' [' . $r['userid'] . ']'; $on = ($r['laston'] >= $_SERVER['REQUEST_TIME'] - 15 * 60) ? '<font color="green"><b>Online</b></font>' : '<font color="red"><b>Offline</b></font>'; $ref_q = $db->query( "SELECT COUNT(`refID`) FROM `referals` WHERE `refREFER` = {$r['userid']}"); $ref = $db->fetch_single($ref_q); $db->free_result($ref_q); echo " <table width=95%><tr><td><h3>Profile for $user_name</h3></tr></td></table>"; if($r['display_pic'] == "") { print "<table width=95% align=center class=table><th colspan=10>General Information</th><tr><td><img src='nopic.jpg' width=150px height=150px/></td>"; print "<td width=50%>Status: {$r['sm']}</td>"; } else { print " <table width=95% align=center cellspacing=1 class=table><th colspan=10>General Information</th><tr><td><img src={$r['display_pic']} width=150px height=150px/></td>"; print "<td width=50%><b>Status:</b> {$r['sm']}</td>"; print "<tr><td><b>Name:</b> $user_name</td><td><b>User Level:</b> $userl</td></tr> <tr><td><b>Gender:</b> {$r['gender']}</td><td><b>Signed Up:</b> $sup</td></tr> <tr><td><b>Property:</b> {$r['hNAME']}</td><td><b>Crystals:</b> {$r['crystals']}</td></tr> <tr><td><b>Referrals:</b> {$ref}</td><td><b>Money:</b> " . money_formatter($r['money']). "</td></tr> <tr><td><b>Duties:</b> {$r['duties']}</td><td><b>Street Steps:</b> {$r['steps']}</td></tr> <tr><th colspan=10>Status</th></tr> <tr><td><b>Online:</b> $on</td><td><b>Level:</b> {$r['level']}</td></tr> <tr><td><b>Last Active:</b> $lon</td><td><b>Health:</b> {$r['hp']}/{$r['maxhp']}</td></tr> <tr><td><b>Days Old:</b> {$r['daysold']}</td><td><b>Location:</b> {$r['cityname']}</td></tr> <tr><td><b>Gang:</b> {$r['gangNAME']}</td><td><b>Rating:</b> <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></td></tr> <tr><th colspan=10>Statistics</th></tr>"; $attacks_won = $db->query(sprintf('SELECT COUNT(`log_id`) AS attacking_won FROM `attacklogs` WHERE `attacker` = %u AND `result` = "%s"', $userid, 'won')); $attacks_wonc = $db->fetch_row($attacks_won); $attacks_lost = $db->query(sprintf('SELECT COUNT(`log_id`) AS attacking_lost FROM `attacklogs` WHERE `attacker` = %u AND `result` = "%s"', $userid, 'lost')); $attacks_lostc = $db->fetch_row($attacks_lost); if ($attacks_lostc['attacking_lost']) { $attacking_perl = $attacks_lostc['attacking_lost'] / ($attacks_wonc['attacking_won'] + $attacks_lostc['attacking_lost']) * 100; } elseif (!$attacks_lostc['attacking_lost']) { $attacking_perl = 0; } if ($attacks_wonc['attacking_won']) { $attacking_perw = $attacks_wonc['attacking_won'] / ($attacks_wonc['attacking_won'] + $attacks_lostc['attacking_lost']) * 100; } elseif (!$attacks_wonc['attacking_won']) { $attacking_perw = 0; } $attacksd_won = $db->query(sprintf('SELECT COUNT(`log_id`) AS defending_won FROM `attacklogs` WHERE `attacked` = %u AND `result` = "%s"', $userid, 'lost')); $attacksd_wonc = $db->fetch_row($attacksd_won); $attacksd_lost = $db->query(sprintf('SELECT COUNT(`log_id`) AS defending_lost FROM `attacklogs` WHERE `attacked` = %u AND `result` = "%s"', $userid, 'won')); $attacksd_lostc = $db->fetch_row($attacksd_lost); if ($attacksd_lostc['defending_lost']) { $defending_perl = $attacksd_lostc['defending_lost'] / ($attacksd_wonc['defending_won'] + $attacksd_lostc['defending_lost']) * 100; } elseif (!$attacksd_lostc['defending_lost']) { $defending_perl = 0; } if ($attacksd_wonc['defending_won']) { $defending_perw = $attacksd_wonc['defending_won'] / ($attacksd_wonc['defending_won'] + $attacksd_lostc['defending_lost']) * 100; } elseif (!$attacksd_wonc['defending_won']) { $defending_perw = 0; } $T_won = $attacks_wonc['attacking_won'] + $attacksd_wonc['defending_won']; $T_lost = $attacks_lostc['attacking_lost'] + $attacksd_lostc['defending_lost']; if ($T_won) { $T_won_per = $T_won / ($T_won + $T_lost) * 100; } elseif (!$T_won) { $T_won_per = 0; } if ($T_lost) { $T_lost_per = $T_lost / ($T_won + $T_lost) * 100; } elseif (!$T_lost) { $T_lost_per = 0; } echo sprintf(' <table width="95%%" class=table bgcolor="#000000" cellspacing=1 cellpadding="0" bordercolor="Silver" border="0"> <tr> <th > <font color=green> Won </font></th> <th > Amount</th> <th > <font color=red> Lost</th> </font> <th > Amount</th> </tr> <tr> <td> <font color=green>Attacking Won</font> </td> <td> %u (%u%%) </td> <center></center> <td> <font color=red> Attacking Lost</font> </td> <td> %u (%u%%) </td> </tr> <tr> <td> <font color=green>Defending Won</font> </td> <td> %u (%u%%) </td> <td> <font color=red>Defending Lost</font> </td> <td> %u (%u%%) </td> </tr> <tr> <td> <font color=green>Total Won</font> </td> <td> %u (%u%%) </td> <td> <font color=red>Total Lost</font> </td> <td> %u (%u%%) </td> ', $attacks_wonc['attacking_won'], $attacking_perw, $attacks_lostc['attacking_lost'], $attacking_perl, $attacksd_wonc['defending_won'], $defending_perw, $attacksd_lostc['defending_lost'], $defending_perl, $T_won, $T_won_per, $T_lost, $T_lost_per ); print "<tr><th colspan=10>Actions</th></tr> <tr><td>[<a href='mailbox.php?action=compose&ID={$r['userid']}'>Send Mail</a>]</td><td>[<a href='sendcash.php?ID={$r['userid']}'>Send Cash</a>]<td>[<a href='sendcrys.php?ID={$r['userid']}'>Send Crystals</a>]</td><td>[<a href='sendbank.php?ID={$r['userid']}'>Bank Xfer</a>]</td></tr> <tr><td>[<a href='sendcyber.php?ID={$r['userid']}'>CyberBank Xfer</a>]</td><td>[<a href='attack.php?ID={$r['userid']}'>Attack</a>]<td>[<a href='contactlist.php?action=add&ID={$r['userid']}'>Add Contact</a>]</td><td>[<a href='nudge.php?ID={$r['userid']}'>Nudge</a>]</td></tr>"; } if ($ir['donatordays'] > 0) { print " <tr><td>[<a href='office.php?ID={$r['userid']}'>Rob Office</a>]</td><td>[<a href='driveby.php?ID={$r['userid']}'>Drive By</a>]<td>[<a href='friendslist.php?action=add&ID={$r['userid']}'>Add Friends</a>]</td><td>[<a href='blacklist.php?action=add&ID={$r['userid']}'>Add Enemies</a>]</td></tr></table>"; print"<hr width=95%/><table class=table cellspacing=1 cellpadding=1 width=95%><tr><th colspan=2>Users Comments <A href=comments.php?ID={$r['userid']}>[Add Comment]</a></th>"; if($ir['userid'] == $r['userid'] || $ir['user_level'] > 1) { print"<th width=10%>Delete</th>"; } print"</tr>"; $blah=mysql_query("SELECT * FROM comments WHERE cmtTO={$r['userid']} ORDER BY cmtTIME DESC limit 5", $c); while($cmnt=mysql_fetch_array($blah)) { $they=mysql_query("SELECT * FROM users WHERE userid={$cmnt['cmtFROM']}",$c); $them=mysql_fetch_array($they); $sent=date('F j, Y, g:i:s a',$cmnt['cmtTIME']); print"<td width=25%><b>{$them['username']} [{$them['userid']}]</br></br></b>$sent</td><Td>{$cmnt['cmtTEXT']}</td>"; if($ir['userid'] == $r['userid'] || $ir['user_level'] > 1) { print"<td width=10%><a href=comments.php?action=delete&ID={$cmnt['cmtID']}>Delete</a></td>"; } print"</tr>"; } print"</table>"; } } function checkblank($in) { if(!$in) { return "N/A"; } return $in; } if($r['profileSIG'] == "") { print "<hr width=95%/><table cellspacing=0 class='table' width='95%'> <tr style='background:gray'> <th><b><center>Profile Signature</center></b></th> </tr> <td><center>This user has not got a profile signature!</center></td> </tr> </table><hr width=95%/><br /><br />"; } else { print "<hr width=95%/><table cellspacing=0 class='table' width='95%'> <tr style='background:gray'> <th><b><center>Profile Signature</center></b></th> </tr> <tr> <td>{$r['profileSIG']}</td> </tr> </table><hr width=95%/><br /><br />"; } } $h->endpage(); ?> Quote
newttster Posted December 1, 2012 Posted December 1, 2012 Can you explain "very dodgy" ... what is it doing. Some scrren shots would help.=)) Quote
JamesRage Posted December 1, 2012 Author Posted December 1, 2012 The Coder has them his engine :) Quote
Uridium Posted December 1, 2012 Posted December 1, 2012 oh i see where its broken........ but like your lack of information im not going to tell you ??? Actually i dont know but you can see from my post how others would see yours.. So try and give as much info to the problem as possible.... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.