Changeset 353 for global.php


Ignore:
Timestamp:
May 1, 2008, 1:20:20 PM (16 years ago)
Author:
george
Message:

Upraveno: Info tabulka na hlavní stránce. Zobrazení počtu hráčů podle tabulky characters namísto account.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • global.php

    r336 r353  
    3838}
    3939
    40 function ShowOnlinePlayerCount()
    41 {
    42   global $Database;
    43  //ini_set('allow_url_fopen', 'On');
    44   // World of Warcraft user stat
    45   //$Content = @file_get_contents('http://wow.zdechov.net:8080/stat.xml');
    46   //$File = fopen('http://'.$WoWServer.'/mangos/inc/stat.xml', 'r');
    47   //$Content = fgets($File, 1000000);
    48   //fclose($File);
     40function OnlinePlayerCount()
     41{
     42  global $Database;
    4943  $Database->select_db('characters');
    5044  $Result = $Database->select('characters', 'COUNT(*)', 'online=1');
    5145  $Row = $Result->fetch_array();
    52   $PlayerCount = $Row[0];
    53  
     46  return($Row[0]);
     47}
     48
     49function CharacterCount()
     50{
     51  global $Database;
     52  $Database->select_db('characters');
     53  $Result = $Database->select('characters', 'COUNT(*)');
     54  $Row = $Result->fetch_array();
     55  return($Row[0]);
     56}
     57
     58function AccountCount()
     59{
     60  global $Database;
     61  $Database->select_db('realmd');
     62  $DbResult = $Database->query('SELECT COUNT(*) FROM account');
     63  $Row = $DbResult->fetch_array();
     64  return($Row[0]);
     65}
     66
     67function MangosUptime()
     68{
     69  global $Database;
     70  $Database->select_db('mangos');
     71  $DbResult = $Database->query('SELECT `starttime`, `uptime` FROM `uptime` ORDER BY `starttime` DESC LIMIT 1');
     72  $Row = $DbResult->fetch_array();
     73  $Uptime = $Row['uptime'];
     74  //$Uptime = 0;
     75  $Days = floor($Uptime / 3600 / 24);
     76  if($Days == 0) $DaysText = '';
     77  else if($Days == 1) $DaysText = $Days.' den';
     78  else if(($Days > 1) and ($Days < 5)) $DaysText = $Days.' dny';
     79  else if(($Days > 5)) $DaysText = $Days.' dnù';
     80  $Seconds = $Uptime - 3600 * 19;
     81  return($DaysText.' '.date('G:i', $Seconds));
     82}
     83
     84function RunningEventCount()
     85{
     86  global $Database;
     87  $Count = 0;
     88  $Database->select_db('mangos');
     89  $DbResult = $Database->select('game_event', '*, UNIX_TIMESTAMP(start_time) as start', 'end_time > NOW() AND start_time < NOW()');
     90  while($Row = $DbResult->fetch_array())
     91  {
     92    $Start = (floor((time() - $Row['start']) / ($Row['occurence'] * 60))) * $Row['occurence'] * 60 + $Row['start'];
     93    $End = $Start + $Row['length'] * 60;
     94    if((time() > $Start) and (time() < $End)) $Count++;
     95  }
     96  return($Count);
     97}
     98
     99function ShowOnlinePlayerCount()
     100{
     101  $PlayerCount = OnlinePlayerCount();
    54102  if($PlayerCount == 1) $P = 'hráè';
    55103  else if(($PlayerCount >= 2) and ($PlayerCount <= 4)) $P = 'hráèi';
Note: See TracChangeset for help on using the changeset viewer.