$result = sql_query("SELECT s.* FROM s_sectors AS s, g_sectors AS g WHERE FIND_IN_SET( s.id, g.csl_sector_id ) and g.user_id=" . $user_id); while ($sector = sql_fetchrow($result)) { $color = $yellow; if (user_is_mutual_friend($user_id, $sector['user_id']) and $sector['user_id'] != $user_id) { if (!flags_is_checked($flags, FLAGS_SECTOR_FRIEND)) { continue; } $color = $green; } if (user_is_enemy($user_id, $sector['user_id'])) { if (!flags_is_checked($flags, FLAGS_SECTOR_ENEMY)) { continue; } $color = $red; } if (user_is_neutral($user_id, $sector['user_id']) or $sector['user_id'] == UID_NOBODY) { if (!flags_is_checked($flags, FLAGS_SECTOR_NEUTRAL)) { continue; } $color = $yellow; } if (user_is_in_aliance($user_id, $sector['user_id'])) { if (!flags_is_checked($flags, FLAGS_SECTOR_ALLIANCE)) { continue; } $color = $purple; } if ($sector['user_id'] == $user_id) { $color = $white; } if (!flags_is_checked($flags, FLAGS_SECTOR_NAMES)) {
function user_showinfo($user_id, $extended_info = USER_SHOWINFO_NORMAL) { assert(is_numeric($user_id)); $user = user_get_user($user_id); $px_user = user_get_perihelion_user($user_id); $result = sql_query("SELECT * FROM perihelion.u_access WHERE user_id=" . $user_id . " ORDER BY login DESC LIMIT 1"); $access = sql_fetchrow($result); sql_query("USE " . $px_user['galaxy_db']); $result = sql_query("SELECT SUM(population) FROM s_anomalies WHERE user_id=" . $user_id); $row = sql_fetchrow($result); $people = $row['0']; $result = sql_query("SELECT COUNT(*) FROM s_sectors WHERE user_id=" . $user_id); $row = sql_fetchrow($result); $sectors_owned = $row['0']; $result = sql_query("SELECT COUNT(*) FROM s_anomalies WHERE user_id=" . $user_id); $row = sql_fetchrow($result); $planets_owned = $row['0']; $result = sql_query("SELECT DISTINCT sector_id, COUNT(*) FROM s_anomalies WHERE user_id=" . $user_id . " GROUP BY sector_id"); $sector_count = sql_countrows($result); $sector = sector_get_sector(user_get_home_sector($user_id)); $planet = anomaly_get_anomaly(user_get_home_planet($user_id)); $race = user_get_race($user_id); $result = sql_query("SELECT * FROM g_alliance WHERE id=" . $user['alliance_id']); $alliance = sql_fetchrow($result); if ($user['alliance_id'] != 0) { $result = sql_query("SELECT COUNT(*) AS count FROM g_users WHERE alliance_id = " . $alliance['id']); $tmp = sql_fetchrow($result); $alliance_size = $tmp['count']; } $status = "Unknown"; if (user_is_friend(user_ourself(), $user_id)) { $status = "Single side friend"; } if (user_is_mutual_friend(user_ourself(), $user_id)) { $status = "Mutual friend"; } if (user_is_neutral(user_ourself(), $user_id)) { $status = "Neutral"; } if (user_is_enemy(user_ourself(), $user_id)) { $status = "Enemy"; } if (user_ourself() == $user_id) { $status = ""; } echo "<table border=0 align=center width=60%>"; echo "<tr><th class=white colspan=2>" . $px_user['name'] . "</th><th> </th></tr>"; echo "<tr><th colspan=2><b>" . $px_user['tag'] . "</b></th></tr>"; echo "<tr valign=top>"; echo " <td width=120>"; echo " <img width=100 height=100 src='images/users/" . $px_user['avatar'] . "'><br>"; echo " <br>"; if ($user['alliance_id'] != 0) { echo " <img width=100 height=100 src='images/users/" . $alliance['avatar'] . "'><br>"; } echo " </td>"; echo " <td><table border=0 nowrap>"; echo " <tr class=bl><td> Full Name </td><td>:</td><td> " . $px_user['name'] . " </td></tr>"; echo " <tr class=bl><td> User ID </td><td>:</td><td> " . $px_user['id'] . " </td></tr>"; echo " <tr class=bl><td> City </td><td>:</td><td> " . $px_user['city'] . " </td></tr>"; echo " <tr class=bl><td> Country </td><td>:</td><td> " . $px_user['country'] . " </td></tr>"; echo " <tr><td colspan=3> </td></tr>"; if ($status != "") { echo " <tr class=bl><td> Diplomatic Status </td><td>:</td><td> " . $status . " </td></tr>"; } echo " <tr class=bl><td> Race </td><td>:</td><td> " . $race . " </td></tr>"; echo " <tr class=bl><td> Home Planet </td><td>:</td><td> " . $planet['name'] . " </td></tr>"; echo " <tr class=bl><td> Home Sector </td><td>:</td><td> " . $sector['name'] . " </td></tr>"; echo " <tr class=bl><td> Population </td><td>:</td><td> " . $people . " </td></tr>"; echo " <tr class=bl><td> Sectors Owned </td><td>:</td><td> " . $sectors_owned . " </td></tr>"; echo " <tr class=bl><td> Planets Owned </td><td>:</td><td> " . $planets_owned . " planet(s) in " . $sector_count . " sector(s) </td></tr>"; if ($user['alliance_id'] != 0) { echo " <tr class=bl><td> Alliance </td><td>:</td><td> <a href=alliance.php?cmd=" . encrypt_get_vars("show") . "&aid=" . encrypt_get_vars($alliance['id']) . ">" . $alliance['name'] . "</a> </td></tr>"; echo " <tr class=bl><td> Alliance Size </td><td>:</td><td> " . $alliance_size . " user(s) </td></tr>"; } echo " <tr><td colspan=3> </td></tr>"; echo " <tr class=bl><td> Times logged in </td><td>:</td><td> " . $px_user['login_count'] . " </td></tr>"; echo " <tr class=bl><td> Last login </td><td>:</td><td> " . $access['login'] . " </td></tr>"; echo " <tr class=bl><td> Last action </td><td>:</td><td> " . $access['logout'] . " </td></tr>"; if ($extended_info == USER_SHOWINFO_EXTENDED) { if ($px_user['gender'] == "M") { $gender = "Male"; } else { $gender = "Female"; } echo " <tr><td colspan=3> </td></tr>"; echo " <tr class=bl><td> Email </td><td>:</td><td> " . $px_user['email'] . " </td></tr>"; echo " <tr class=bl><td> Login Name </td><td>:</td><td> " . $px_user['login_name'] . " </td></tr>"; echo " <tr><td colspan=3> </td></tr>"; echo " <tr class=bl><td> City </td><td>:</td><td> " . $px_user['city'] . " </td></tr>"; echo " <tr class=bl><td> Country </td><td>:</td><td> " . $px_user['country'] . " </td></tr>"; echo " <tr><td colspan=3> </td></tr>"; echo " <tr class=bl><td> Birthday </td><td>:</td><td> " . $px_user['birthday'] . " </td></tr>"; echo " <tr class=bl><td> Gender </td><td>:</td><td> " . $gender . " </td></tr>"; } if ($user_id != user_ourself()) { echo "<tr><th colspan=3>"; echo "[ <a href=message.php?uid=" . encrypt_get_vars($user_id) . ">Send Message</a> ]"; echo "</th></tr>"; echo "<tr><th colspan=3>"; echo "[ <a href=user.php?cmd=" . encrypt_get_vars("relation") . "&uid=" . encrypt_get_vars($user_id) . "&wid=" . encrypt_get_vars(RELATION_FRIEND) . ">Set as friend</a> ] - "; echo "[ <a href=user.php?cmd=" . encrypt_get_vars("relation") . "&uid=" . encrypt_get_vars($user_id) . "&wid=" . encrypt_get_vars(RELATION_NEUTRAL) . ">Set as neutral</a> ] - "; echo "[ <a href=user.php?cmd=" . encrypt_get_vars("relation") . "&uid=" . encrypt_get_vars($user_id) . "&wid=" . encrypt_get_vars(RELATION_ENEMY) . ">Set as enemy</a> ]"; echo "</th></tr>"; } echo " </table></td>"; echo "</tr>"; echo "</table>"; echo "<br><br>"; }