Page 1 of 2
[SHARE] Top Adena PHP script
Posted: Sun Aug 08, 2010 2:56 pm
by pinkcore
This PHP script will list richest people from server.
This script ignores all Admin / GMs characters as you can see (accessLevel = 0) in query.
First define your MySQL connection:
Code: Select all
$db_link = mysql_connect('host', 'user', 'password');
And choose your database:
Code: Select all
$db_selected = mysql_select_db("database",$db_link);
Default script list only Top 10 players, if you want other number just change the limit at the end of query in $query_chars
Code: Select all
<?php$db_link = mysql_connect('host', 'user', 'password'); mysql_query("SET CHARACTER SET utf8");if (!$db_link) { echo('Could not connect: ' . mysql_error());}$db_selected = mysql_select_db("database",$db_link);$FORM = "<table> <tr> <th align=center>Pos.</th> <th width='175px' class='Stil5' align=center>Character</th> <th width='150px' class='Stil5' align=center>Wealth</th> </tr>"; $query_chars = "SELECT * FROM items INNER JOIN characters ON items.owner_id=characters.charId WHERE item_id=57 AND characters.accesslevel = 0 AND items.loc='INVENTORY' order by count desc limit 10"; $link = mysql_query($query_chars); $i=1; $r=255; while ( $row=mysql_fetch_array($link) ) { $FORM .= "<tr> <td align=center>$i</span></td> <td align=center>$row[char_name]</td> <td align=center>".number_format($row['count'])."</td> </tr>"; $i++; $r -= 0; } echo $FORM;echo '</table>';?>
Credits goes to me

Enjoy!

Re: [SHARE] Top Adena PHP script
Posted: Mon Aug 09, 2010 2:14 am
by labman
But...
排名 玩家 財產
1 先知ㄇㄟ 4,799,999,980
2 先知ㄇㄟ 200,000,000
Re: [SHARE] Top Adena PHP script
Posted: Mon Aug 09, 2010 9:41 am
by pinkcore
Sorry but i absolutely don't know whats going on :XX
Can you translate it to english language please?
Re: [SHARE] Top Adena PHP script
Posted: Mon Aug 09, 2010 11:13 am
by jurchiks
if i'm correct the script doesn't count the adena stored in the warehouse
Re: [SHARE] Top Adena PHP script
Posted: Mon Aug 09, 2010 4:42 pm
by pinkcore
The script only list the maximum number of adenas and there is no restriction for WAREHOUSE and INVENTORY.
First post edited: Now it count only with adenas in inventory, warehouse will be ignored. (Beacuse i don't have much time for now to make INVENTORY + WAREHOUSE values)
Re: [SHARE] Top Adena PHP script
Posted: Mon Aug 09, 2010 5:48 pm
by jurchiks
I meant that as a guess for labman's post, cuz I can't really think of anything else it might mean...
Re: [SHARE] Top Adena PHP script
Posted: Tue Aug 10, 2010 1:15 am
by labman
No problem now. Thank you for your correction. For my bad English, I am sorry...
Re: [SHARE] Top Adena PHP script
Posted: Sun Dec 26, 2010 8:34 am
by mrvietdung
It's security? Can anyone hacking and see the user and pass of DB? I dunno much about PHP, and i scare...
Re: [SHARE] Top Adena PHP script
Posted: Thu Dec 30, 2010 9:01 pm
by pinkcore
mrvietdung wrote:It's security? Can anyone hacking and see the user and pass of DB? I dunno much about PHP, and i scare...
Don't be afraid, scripts with MySQL Connections are used everywhere in the world.

Re: [SHARE] Top Adena PHP script
Posted: Thu Jan 13, 2011 11:53 am
by xalis
pinkcore wrote:(Beacuse i don't have much time for now to make INVENTORY + WAREHOUSE values)
Code: Select all
<?php$db_link = mysql_connect('host', 'user', 'password') or die (mysql_error());mysql_query("SET NAMES 'utf8';") or die (mysql_error());$db_selected = mysql_select_db("database",$db_link) or die (mysql_error());$FORM = '<table><tr><th align=center>Pos.</th><th width="175px" class="Stil5" align=center>Character</th><th width="150px" class="Stil5" align=center>Wealth</th></tr>';$i=1;$r=255; $mq = mysql_query('SELECT `characters`.`charId`,`characters`.`char_name`,`characters`.`accesslevel`,`owner_id`,`item_id`,SUM(`count`) "nbItem" FROM `characters`,`items` WHERE `items`.`owner_id` = `characters`.`charId` AND `characters`.`accesslevel` = 0 AND `loc` <> "CLANWH" AND `item_id` = 57 GROUP BY `owner_id` ORDER BY SUM(`count`) DESC LIMIT 0,10;') or die (mysql_error());while ($mfo = mysql_fetch_object($mq)) { $FORM .= '<tr> <td align=center>'.$i.'</span></td> <td align=center>'.$mfo->char_name.'</td> <td align=center>'.number_format($mfo->nbItem).'</td> </tr>'; $i++; $r -= 0;}$FORM .= '</table>';echo $FORM;mysql_free_results($mq);mysql_free_results($mfo);mysql_close($db_link);?>
Calculate all adena in all places except CLANWH (including Mails so)
Hope this will be useful
Re: [SHARE] Top Adena PHP script
Posted: Thu Jan 20, 2011 2:15 pm
by daedalus
It's nothing but return only the char's name and him amount of adena.
Code: Select all
SELECT C.`char_name`,SUM(`count`) "nbItem" FROM `characters` C,`items` I WHERE I.`owner_id` = C.`charId` AND C.`accesslevel` = 0 AND I.`loc` <> "CLANWH" AND I.`item_id` = 57 GROUP BY I.`owner_id` ORDER BY SUM(`count`) DESC LIMIT 0,10;
(not tested)
Re: [SHARE] Top Adena PHP script
Posted: Thu Jan 20, 2011 7:22 pm
by shamanidze
Query rich player:
Code: Select all
SELECT charId, char_name, accesslevel, IFNULL(c_w,0) AS weapon, IFNULL(c_ar,0) AS armor, IFNULL(c_e,0) AS etcitem, IFNULL(c_ad,0) AS adena, IFNULL(c_w,0)+IFNULL(c_ar,0)+IFNULL(c_e,0)+IFNULL(c_ad,0) AS summary FROM characters LEFT JOIN (SELECT owner_id,SUM(count*price) AS c_w FROM items,weapon WHERE items.item_id=weapon.item_id GROUP BY owner_id) AS t_w ON characters.charId=t_w.owner_id LEFT JOIN (SELECT owner_id,SUM(count*price) AS c_ar FROM items,armor WHERE items.item_id=armor.item_id GROUP BY owner_id) AS t_ar ON characters.charId=t_ar.owner_id LEFT JOIN (SELECT owner_id,SUM(count*price) AS c_e FROM items,etcitem WHERE items.item_id != 57 AND items.item_id=etcitem.item_id GROUP BY owner_id) AS t_e ON characters.charId=t_e.owner_id LEFT JOIN (SELECT owner_id,SUM(count) AS c_ad FROM items WHERE items.item_id=57 GROUP BY owner_id) AS t_ad ON characters.charId=t_ad.owner_id WHERE accesslevel=0 ORDER BY summary DESC LIMIT 50
need php scripts?
Re: [SHARE] Top Adena PHP script
Posted: Thu Jan 20, 2011 7:24 pm
by jurchiks
weapon/armor/etcitem tables no longer exist.
Re: [SHARE] Top Adena PHP script
Posted: Thu Jan 20, 2011 7:30 pm
by shamanidze
I added table armor, weapon and etsitem for scripts rich, searchdopmob, searchmobdrop...
My site playerfriendle usability. Sorry my english. Russian
Re: [SHARE] Top Adena PHP script
Posted: Fri Jan 21, 2011 8:49 am
by pinkcore
shamanidze wrote:I added table armor, weapon and etsitem for scripts rich, searchdopmob, searchmobdrop...
My site playerfriendle usability. Sorry my english. Russian
Remove these tables and read information from XML files.