problem that is/was appearing under this page rankings was that all pets that went over 1000* was shown under statistic page as a 0*
this is original content of pets.php file
Code:
<?php include('definitions.php'); ?> <h2><span></span></h2> <br /><br /> <center><div align="center"> <form action='index.php?id=pets' method=POST> <select name="type" onChange="this.form.submit()"> <option value="top10">Please choose a catagory</option> <?php $pKeys = array_keys($eudemon); foreach ($pKeys as $pId) { $pSelected = ""; if ($pId == $_POST['type']) { $pSelected = "selected"; }; echo "<option value='" . $pId . "'" . $pSelected . ">" . $eudemon[$pId] . "</option>"; } unset($pId); ?> </select> </form> </div> <br><p> <head> <table width="210" height="137" border="0"> <tr> <td><strong>Rank</strong></td> <td><strong>Owner</strong></td> <td><strong>Name</strong></td> <td><strong>Type</strong></td> <td><strong>Level</strong></td> <td><strong>Stars</strong></td> <td><strong>Reborns</strong></td> </tr> <?php $pId = $_POST['type']; $pId = $pId[0] . $pId[1]; switch($pId) { case "top10": $sQuery = mysql_query("SELECT * FROM cq_eudemon WHERE `ori_owner_name` NOT LIKE '%[PM]%' ORDER BY star_lev DESC LIMIT 50"); default: $sQuery = mysql_query("SELECT * FROM cq_eudemon WHERE (`ori_owner_name` NOT LIKE '%[PM]%' AND `item_type` LIKE '1071$pId%' OR `item_type` LIKE '1079$pId%' OR `item_type` LIKE '1081$pId%') ORDER BY star_lev DESC LIMIT 50"); } $rank = 1; while ($pet = mysql_fetch_assoc($sQuery)) { $star_lev = $pet['star_lev']; $stars = ""; $item_type = $pet['item_type']; $type = ""; [COLOR="Red"]if (strlen($star_lev) == 4) { $stars = $star_lev[0] . $star_lev[1]; } else if (strlen($star_lev) == 5) { $stars = $star_lev[0] . $star_lev[1] . $star_lev[2]; } else { $stars = 0; }[/COLOR] $type = $eudemon[$item_type[strlen($item_type)-3] . $item_type[strlen($item_type)-2] . "0"]; $sql = "SELECT * FROM cq_user WHERE id='".$pet['player_id']."'"; $query = mysql_query($sql) or die(mysql_error()); $row1 = mysql_fetch_object($query); $curowner = htmlspecialchars($row1->name); echo "<tr>"; echo "<td>" . $rank . "</td>"; echo "<td>" . $curowner . "</td>"; echo "<td>" . $pet['name'] . "</td>"; echo "<td>" . $type . "</td>"; echo "<td>" . $pet['level'] . "</td>"; echo "<td>" . $stars . "</td>"; echo "<td>" . $pet['reborn_times'] . "</td>"; echo "</tr>"; $rank++; } ?> </table>
ok from:
Code:
[COLOR="Red"]if (strlen($star_lev) == 4) { $stars = $star_lev[0] . $star_lev[1]; } else if (strlen($star_lev) == 5) { $stars = $star_lev[0] . $star_lev[1] . $star_lev[2]; } else { $stars = 0; }[/COLOR]
Code:
[COLOR="Red"]if (strlen($star_lev) == 4) { $stars = $star_lev[0] . $star_lev[1]; } else if (strlen($star_lev) == 5) { $stars = $star_lev[0] . $star_lev[1] . $star_lev[2]; } else if (strlen($star_lev) == 6) { $stars = $star_lev[0] . $star_lev[1] . $star_lev[2] . $star_lev[3]; } else { $stars = 0; }[/COLOR]
so proper content of pets.php - basing on original will be:
Code:
<?php include('definitions.php'); ?> <h2><span></span></h2> <br /><br /> <center><div align="center"> <form action='index.php?id=pets' method=POST> <select name="type" onChange="this.form.submit()"> <option value="top10">Please choose a catagory</option> <?php $pKeys = array_keys($eudemon); foreach ($pKeys as $pId) { $pSelected = ""; if ($pId == $_POST['type']) { $pSelected = "selected"; }; echo "<option value='" . $pId . "'" . $pSelected . ">" . $eudemon[$pId] . "</option>"; } unset($pId); ?> </select> </form> </div> <br><p> <head> <table width="210" height="137" border="0"> <tr> <td><strong>Rank</strong></td> <td><strong>Owner</strong></td> <td><strong>Name</strong></td> <td><strong>Type</strong></td> <td><strong>Level</strong></td> <td><strong>Stars</strong></td> <td><strong>Reborns</strong></td> </tr> <?php $pId = $_POST['type']; $pId = $pId[0] . $pId[1]; switch($pId) { case "top10": $sQuery = mysql_query("SELECT * FROM cq_eudemon WHERE `ori_owner_name` NOT LIKE '%[PM]%' ORDER BY star_lev DESC LIMIT 50"); default: $sQuery = mysql_query("SELECT * FROM cq_eudemon WHERE (`ori_owner_name` NOT LIKE '%[PM]%' AND `item_type` LIKE '1071$pId%' OR `item_type` LIKE '1079$pId%' OR `item_type` LIKE '1081$pId%') ORDER BY star_lev DESC LIMIT 50"); } $rank = 1; while ($pet = mysql_fetch_assoc($sQuery)) { $star_lev = $pet['star_lev']; $stars = ""; $item_type = $pet['item_type']; $type = ""; if (strlen($star_lev) == 4) { $stars = $star_lev[0] . $star_lev[1]; } else if (strlen($star_lev) == 5) { $stars = $star_lev[0] . $star_lev[1] . $star_lev[2]; } else if (strlen($star_lev) == 6) { $stars = $star_lev[0] . $star_lev[1] . $star_lev[2] . $star_lev[3]; } else { $stars = 0; } $type = $eudemon[$item_type[strlen($item_type)-3] . $item_type[strlen($item_type)-2] . "0"]; $sql = "SELECT * FROM cq_user WHERE id='".$pet['player_id']."'"; $query = mysql_query($sql) or die(mysql_error()); $row1 = mysql_fetch_object($query); $curowner = htmlspecialchars($row1->name); echo "<tr>"; echo "<td>" . $rank . "</td>"; echo "<td>" . $curowner . "</td>"; echo "<td>" . $pet['name'] . "</td>"; echo "<td>" . $type . "</td>"; echo "<td>" . $pet['level'] . "</td>"; echo "<td>" . $stars . "</td>"; echo "<td>" . $pet['reborn_times'] . "</td>"; echo "</tr>"; $rank++; } ?> </table>
and of course this file can/should be little more cleared .... this guide is about this specific problem and this solution will help -- as I spoted half servers that are currently online ... LOL :/ hehe
Regards