[Release]Eudemon Rankings

02/06/2008 03:14 jackyyll#1
Here's the PHP script for top 10 eudemons of each type...

(Note: I think a few eudemons are missiong from the definitions array, so.. Yeah you'll have to find out which are missing and add them yourself.. Just find the last three digits of their id and turn the last digit into a 0 and add them to the list like the rest are.)


definitions.php
PHP Code:
<?php
    $eudemon
['000'] = "WarriorPatk";
    
$eudemon['010'] = "WarriorPdef";
    
$eudemon['020'] = "WarriorAtkDef";
    
$eudemon['040'] = "WarriorLanir";
    
$eudemon['060'] = "WarriorCute";
    
$eudemon['070'] = "SaintDragon";
    
$eudemon['080'] = "WarriorRex";
    
$eudemon['090'] = "WarriorNeil";
    
$eudemon['200'] = "MageMatk";
    
$eudemon['210'] = "MageTina";
    
$eudemon['220'] = "MageAtkDef";
    
$eudemon['230'] = "MageGos";
    
$eudemon['240'] = "MageMdef";
    
$eudemon['400'] = "WarriorGeppy";
    
$eudemon['410'] = "WarriorNana";
    
$eudemon['420'] = "WarriorLulu";
    
$eudemon['440'] = "StormSoul";
    
$eudemon['450'] = "VenusSage";
    
$eudemon['460'] = "VenusPhantom";
    
$eudemon['500'] = "MagePipy";
    
$eudemon['510'] = "MageGeppy";
    
$eudemon['520'] = "MageDodo";
    
$eudemon['540'] = "HellfirePike";
    
$eudemon['550'] = "BloodSage";
    
$eudemon['560'] = "BloodPhantom";
    
$eudemon['700'] = "EudemonAustin";
    
$eudemon['710'] = "EudemonFlora";
    
$eudemon['720'] = "EudemonAdam";
    
$eudemon['800'] = "SaphireDino";
    
$eudemon['810'] = "RubyDino";
    
$eudemon['820'] = "SnowRaptor";
    
$eudemon['830'] = "FireRaptor";
    
$eudemon['840'] = "BronzeRhino";
    
$eudemon['850'] = "CopperRhino";
    
$eudemon['860'] = "SaintBear";
    
$eudemon['980'] = "UniversalXO";
    
$eudemon['990'] = "UniversalO";
?>

eudranking.php
PHP Code:
<?php
    
include('definitions.php');

    
$dbHost "localhost";
    
$dbUser "root";
    
$dbPass "";
    
$dbName "my";

    
mysql_connect($dbHost$dbUser$dbPass);
    
mysql_select_db($dbName);
?>
<div align="right">
    <form action='eudranking.php' method=POST>
        Pet Type <select name="type" onChange="this.form.submit()">
        <option value="top10">Top 10</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>
<table>
    <tr>
    <td>Rank</td><td>Owner</td><td>Name</td><td>Type</td><td>Level</td><td>Stars</td><td>Reborns</td>
    </tr>
    <?php
        $pId 
$_POST['type'];
        
$pId $pId[0] . $pId[1];
        switch(
$pId) {
            case 
"top10":
                
$sQuery mysql_query("SELECT ori_owner_name, name, star_lev, level, reborn_times, item_type FROM cq_eudemon ORDER BY star_lev DESC LIMIT 10");
            default:
                
$sQuery mysql_query("SELECT ori_owner_name, name, star_lev, level, reborn_times, item_type FROM cq_eudemon WHERE (`item_type` LIKE '1071$pId%' OR `item_type` LIKE '1079$pId%' OR `item_type` LIKE '1081$pId%') ORDER BY star_lev DESC LIMIT 10");
        }

        
$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 {
                
$stars 0;
            }

            
$type $eudemon[$item_type[strlen($item_type)-3] . $item_type[strlen($item_type)-2] . "0"];

            echo 
"<tr>";
            echo 
"<td>" $rank "</td>";
            echo 
"<td>" $pet['ori_owner_name'] . "</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>

Enjoy.
02/06/2008 04:38 DarkBebi#2
jackyll this eudemon script works great i love it
02/06/2008 05:00 jackyyll#3
Sorry, i made a small mistake in eudranking.php, here is a fixed version:

Gah, the php parser for the [ php] BBCode seems to be broken on this forum, so i hosted the new version on my website

eudranking.php
[Only registered and activated users can see links. Click Here To Register...]
(Make sure you name it eudranking.php NOT eudranking.phps)

definitions.php
[Only registered and activated users can see links. Click Here To Register...]
(Make sure you name it definitions.php NOT definitions.phps)