PHP Script for Top Players.

Azura

Mir3 Coder & Adviser
Mar 12, 2005
3,249
111
300
Dont know if this is any help to people but I was bored last night and was writing so little PHP scripts.

Here is an example to show Top 10 Levels on your server.

PHP:
<?php
$hostname = "<Host IP>";
$username = "<DB USERNAME>";
$password = "<DB PASSWORD>";
$dbName = "<DB NAME>";
MSSQL_CONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND.");
mssql_select_db($dbName) or DIE("Table unavailable");
$query = "SELECT TOP 10 FLD_CHARNAME FROM TBL_CHARINFO WHERE FLD_LEVEL>0 AND FLD_LEVEL<9999 ORDER BY FLD_LEVEL DESC";
$result = mssql_query( $query );
while($line = mssql_fetch_row($result)){
print "$line[0]<br>";
}?>

Working on Reviving Leo's Server Monitor, Also creating a program to run server-side and save/send info about the server to my ftp and display it on the monitor.

testi.png
 
Last edited:

Mask

Banned
Banned
Golden Oldie
Jun 20, 2003
1,695
22
195
United Kingdom
can this be used externally? i.e from another pc/server?

also your server monitor is looking nice :)
 
Last edited:

Azura

Mir3 Coder & Adviser
Mar 12, 2005
3,249
111
300
can this be used externally? i.e from another pc/server?

also your server monitor is looking nice :)

It can be If you have to correct details (Username, Password and IP). Tho I don't think people would like to give that information out which is why im coding the program in delphi. So it reads the Connection details Internally and sends the Character Info without storing any secuirity or connection information to keep servers safe but still display the information.
 
Last edited:

Mask

Banned
Banned
Golden Oldie
Jun 20, 2003
1,695
22
195
United Kingdom
It can be If you have to correct details (Username, Password and IP). Tho I don't think people would like to give that information out which is why im coding the program in delphi. So it reads the Connection details Internally and sends the Character Info without storing any secuirity or connection information to keep servers save but still display the information.
ok great thanks :)
 

Primal

LOMCN VIP
VIP
Jun 28, 2004
1,756
102
259
i know about this, but it only works if they use sql, i tried figurin out bowt normal db but cudnt do it
 

Azura

Mir3 Coder & Adviser
Mar 12, 2005
3,249
111
300
It also works with MySQL, I dont know why people wouldnt use MSSQL anyway. 2.3, 2.6 and Phili all use MSSQL.
 

Primal

LOMCN VIP
VIP
Jun 28, 2004
1,756
102
259
im also working on same sort of fing, need sum1 with a server using sql tho
 

jasper

Golden Oldie
Golden Oldie
Sep 10, 2005
890
3
125
would you not also look at the exp table? to order by, or else all lvl 50 players will be tied, even if one has 99% and another has 1%?
 

Azura

Mir3 Coder & Adviser
Mar 12, 2005
3,249
111
300
I dont think you can because the DB doesn't have the MAXEXP field. I will try using the EXP field it should work.
 

jasper

Golden Oldie
Golden Oldie
Sep 10, 2005
890
3
125
will do if you were to ORDER BY Fld_Level DESC, Fld_Exp DESC
 

Floyd

Golden Oldie
Golden Oldie
Aug 2, 2004
1,320
0
143
You've certaintly got your fingers in a lot of pies...

Old habits die hard, if you didn't already know.
 

Azura

Mir3 Coder & Adviser
Mar 12, 2005
3,249
111
300
Its been awhile since I actually did stuff for mir and I'm always bored looking for a challange. Even if I dont complete things I post it because other people can use it and carry it on. Im sure Primal will use the SQL script.
 

Primal

LOMCN VIP
VIP
Jun 28, 2004
1,756
102
259
iv had a script for this for a while, just no1 with a server using sql to help me sort it / get it working. not sure that yours would work correctly either tho,but like i say i need sum1 with a server up using sql to be able to find out if things are working or not.

jasper -
youd only have to sort it by the Fld_exp as the person with the most exp would also be the person with the highest level, you cant sort by 2 different fields i dont think.

gimme sum1 with an sql server n il get it working for every1
 
Last edited:

jasper

Golden Oldie
Golden Oldie
Sep 10, 2005
890
3
125
if sorting on exp only, somebody lvl 1 with 50 exp would show higher than somebody lvl 50 with 1 exp , and yes, u can sort on 2 fields using a comma
 

Azura

Mir3 Coder & Adviser
Mar 12, 2005
3,249
111
300
Primal every 2.3 servers uses SQL. You need to come up with a way to read it but not store their SQL IP, Username and Password otherwise people will not help you.

The script can be ran server-side as the SQL details would be hiden.
 

Primal

LOMCN VIP
VIP
Jun 28, 2004
1,756
102
259
if sorting on exp only, somebody lvl 1 with 50 exp would show higher than somebody lvl 50 with 1 exp , and yes, u can sort on 2 fields using a comma

1 exp wudnt be level 50, it shows as like 1033443543 doesnt it? so 1 exp wud still be level 1

azura - not sure if you can without making a program to export the info, but u mite be able to if i had sum1 to help me who had an sql server could work round not usin the passwords

edit: also i can make it so the sql username + pass are encoded when theyre stored so you cant actually see what they are but the php scripts can read them correct