[Guide] Top 25 Online User PHP Code

MorgaN

Active Member
Joined
Apr 23, 2008
Messages
709
Reaction score
101
Hi all , i think this my little guide help some ppl.
It work with odbc and mssql, then no problem with integration.
the ranking take the top 25 online players.

Script : (Modules/Most Online.php)

Code Here:
Code:
<div align="center">
  <div align="center">
    <table width="50%" border="0" cellspacing="1" cellpadding="1">
      <tr>
        <td class="normal_text_white">Players</td>
        <td class="normal_text_white">Online Time</td>
        <td class="normal_text_white">Status</td>
      </tr>
  <?php

/**
 * @Throzen
 * @copyright 2008
 */
 
if( !isset($_GET['op']))
{
    require('../includes/denied.php');
    denied('Time');
}
require('config.php');

//We get the user
$online = $db->Execute('SELECT DISTINCT 
TOP 25
AccountCharacter.ID, 
AccountCharacter.GameIDC, 
MEMB_STAT.ServerName, 
MEMB_STAT.IP, 
MEMB_STAT.ConnectTM, 
MEMB_STAT.DisConnectTM,
MEMB_STAT.OnlineHours
from 
MEMB_STAT 
join 
AccountCharacter 
on 
Memb_stat.memb___id = AccountCharacter.ID
ORDER BY 
MEMB_STAT.OnlineHours DESC');
while($online_time = $online->fetchrow())
{
//Maybe the statut too
$statut = $db->Execute("Select ConnectStat FROM MEMB_STAT WHERE memb___id='".$online_time[0]."'");
$statut_ok = $statut->fetchrow();
if($statut_ok[0] == 1){$online_stat = '<span style="color:green"><b>Online</b></span>';}
elseif($statut_ok[0] == 0){$online_stat = '<span style="color:red"><b>Offline</b></span>';}
?>
      <tr>
        <td class="normal_text_white"><a href="index.php?op=character&character=<?=$online_time[1];?>"><?=$online_time[1];?></a></td>
        <td class="normal_text_white"><?=$online_time[6];?></td>
        <td class="normal_text_white"><?=$online_stat?></td>
      </tr>
  <?
}
?>
      </table>
</div>
 
  • Like
Reactions: SuMMeR

Murder

New Member
Joined
Apr 21, 2008
Messages
502
Reaction score
74
This is only for muweb 0.8.. What to change in the file to get it work ?!
 
Last edited:

MorgaN

Active Member
Joined
Apr 23, 2008
Messages
709
Reaction score
101
hmm , you must have season 1 or 2 or 3 , what season you have?
 

ReaL

New Member
Joined
Apr 13, 2008
Messages
1,244
Reaction score
654
It's cuz there are changes in the new DBs of the new versions (s1 s2 and 3), the column in your DB has another name (the column, which shows minutes online)! So look in the DB and change the php file ;)
 

MorgaN

Active Member
Joined
Apr 23, 2008
Messages
709
Reaction score
101
yes that need ty ReaL :blush-anim-cl:
 

MorgaN

Active Member
Joined
Apr 23, 2008
Messages
709
Reaction score
101
Here is my old php.ini , is work on all version obc.reg

Download : HERE
 

Mephisto

New Member
Joined
Apr 10, 2008
Messages
451
Reaction score
240
this will not work on old version cause this
PHP:
MEMB_STAT.OnlineHours
missing for old version must be

PHP:
//We get the user
$online = $db->Execute('SELECT DISTINCT 
TOP 25
AccountCharacter.ID, 
AccountCharacter.GameIDC, 
MEMB_STAT.ServerName, 
MEMB_STAT.IP, 
MEMB_STAT.ConnectTM, 
MEMB_STAT.DisConnectTM,
from 
MEMB_STAT 
join 
AccountCharacter 
on 
Memb_stat.memb___id = AccountCharacter.ID
ORDER BY 
MEMB_STAT.OnlineHours DESC');
 

Mephisto

New Member
Joined
Apr 10, 2008
Messages
451
Reaction score
240
Ups my bad
PHP:
//We get the user
$online = $db->Execute('SELECT DISTINCT 
TOP 25
AccountCharacter.ID, 
AccountCharacter.GameIDC, 
MEMB_STAT.ServerName, 
MEMB_STAT.IP, 
MEMB_STAT.ConnectTM, 
MEMB_STAT.DisConnectTM,
from 
MEMB_STAT 
join 
AccountCharacter 
on 
Memb_stat.memb___id = AccountCharacter.ID
ORDER BY 
MEMB_STAT.ConnectTM DESC');
this should work
 

Similar threads