<?php require_once './www.playconquest.com/db_connect.php'; //include('./db_connect.php'); $servercount = getServerNumber(); for ($x = 1; $x < $servercount + 1; $x++) { $query = "SELECT ownerpid FROM galaxy{$x} WHERE ownerpid>0"; $result = @mysql_query($query); $sid = $x; while ($row = mysql_fetch_array($result)) { $pid = $row[0]; $id = getPlanetStat(ownerid, $sid, $pid); for ($y = 1; $y < getMaxServer() + 1; $y++) { $str = 's' . $y; $number = getUserStat($str, $id); if ($number == $sid) { $number = $y; break; } } $str = 'points' . $number; $points = getUserStat($str, $id); $points++; echo $str; $query2 = "UPDATE users SET {$str}={$points} WHERE id={$id}"; $result2 = @mysql_query($query2); } }
<?php /**/ include './header.php'; echo '<table align="center" cellspacing="5"> <tr> <td></td> <td><b>Name</b></td> <td><b>Points</b></td> </tr>'; $count = 0; $query = "SELECT id,s1,s2 FROM users WHERE s1={$sid} OR s2={$sid}"; $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { for ($x = 1; $x < getMaxServer() + 1; $x++) { $str = 's' . $x; $number = getUserStat($str, $row[id]); if ($number == $sid) { $number = $x; break; } } $str = 'points' . $number; $points = getUserStat($str, $row[id]); $arr[$row[id]] = $points; } arsort($arr); foreach ($arr as $key => $val) { if ($count > 100) { break; }
function getPoints($sid, $id) { for ($x = 1; $x < getMaxServer() + 1; $x++) { $str = 's' . $x; $query = "SELECT {$str} FROM users WHERE id={$id}"; $result = mysql_query($query); $row = mysql_fetch_array($result); if ($row[0] == $sid) { $str = 'rp' . $x; $query = "SELECT {$str} FROM users WHERE id={$id}"; $result = mysql_query($query); $row = mysql_fetch_array($result); return $row[0]; } } return -1; }