Changeset 353


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.

Files:
2 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';
  • index.php

    r343 r353  
    99<div>
    1010Vítejte na serveru <span class="Nadpis">Heroes of Fantasy</span>, neoficiálním herním serveru hry <a href="http://www.worldofwarcraft.com/">World of Warcraft</a>!<br>
    11 WoW je <acronym title="Massive Multiplayer Online Role Playing Game">MMORPG</acronym> její¾ tvùrcem je spoleènost <a href="http://www.blizzard.com/">Blizzard Entertainment</a>.
    12 Existují oficiální servery, na kterých je nutno platit mìsíèní poplatek. Tento server je v¹ak neoficiální a mù¾ete zde hrát zdarma. Pøesto¾e neoficiální servery nikdy nedosáhnou takové kvality jako oficiální, mù¾ete zde za¾ít mnoho pøíjemných chvil a seznámit se zajímavými lidmi.
     11WoW je <acronym title="Massive Multiplayer Online Role Playing Game">MMORPG</acronym> vytvoøená spoleèností <a href="http://www.blizzard.com/">Blizzard Entertainment</a>.
     12Ta provozuje oficiální servery, na kterých je nutno platit mìsíèní poplatek. Tento server je v¹ak neoficiální a mù¾ete zde hrát zdarma. Pøesto¾e neoficiální servery nikdy nedosáhnou takové kvality jako oficiální, mù¾ete zde za¾ít mnoho pøíjemných chvil a seznámit se zajímavými lidmi.
    1313Nyní je ji¾ potøeba se jenom zaregistrovat, pøipojit do hry a v¾ít se do role hrdiny, který putuje svìtem fantasie a utkává se v boji s rozliènými stvùrami.     
    1414</div>
    1515<table id="SplitTable" cellspacing="5" cellpadding="0" width="100%">
    1616<tr><td width="60%" valign="top">');
    17 
    1817
    1918echo(ShowNews());
     
    2322// Second column
    2423
    25 //echo(Events());
    26 
    2724echo('<br>
    2825<div align="center">
    2926<table class="MiniTable" border="1" cellspacing="0" cellpadding="2">
    3027<tr><th>Emulátor</th><td>MaNGOS</td></tr>
    31 <tr><th>Verze hry</th><td>');
    32 echo($Config['Mangos']['ClientVersion']);
    33 echo('</td></tr>'.
     28<tr><th>Verze hry</th><td>'.$Config['Mangos']['ClientVersion'].'</td></tr>'.
    3429'<tr><th>Stav</th><td>');
    3530if(CheckPortStatus($WoWServer, 8085)) echo('<span style="color: #33ff33;">ONLINE</span>');
    3631  else echo('<span style="color: red;">OFFLINE</span>');
    3732echo('</td></tr>
    38 <tr><th>Online hráèù</th><td><a href="http://'.$WoWServer.'/online_player.php">');
     33<tr><th>Doba bìhu</th><td>'.MangosUptime().'</td></tr>
     34<tr><th>Online hráèù</th><td><a href="'.$BaseUrl.'/online_player.php">'.OnlinePlayerCount().'</a></td></tr>
    3935
    40 $Database->select_db('realmd');
    41 $Result = $Database->select('account', 'COUNT(*)', 'online=1');
    42 $Row = $Result->fetch_array();
    43 $PlayersOnlineCount = $Row[0];
    44 echo($PlayersOnlineCount);
    45 
    46 echo('</a></td></tr>
    47 
    48 <tr><th>Návod</th><td><a href="jak_zacit.php">zde</a></td></tr>
    4936<tr><th>Stav registrací</th><td>');
    5037include('registrace/reg_config.php');
    51 $Database->select_db('realmd');
    52 $DbResult = $Database->query('SELECT COUNT(*) FROM account');
    53 $Row = $DbResult->fetch_array();
    54 $AccountCount = $Row[0];
     38$AccountCount = AccountCount();
    5539$Remain = $MaximumAccountCount-$AccountCount;
    5640if($Remain <= 0) echo('VYÈERPANÉ'); else echo('VOLNÉ');
    57 echo('</td></tr>
     41echo('</td></tr>');
     42/*
     43<tr><th>Návod</th><td><a href="jak_zacit.php">zde</a></td></tr>
    5844<tr><th>Registrace</th><td>');
    5945echo('<a href="'.$BaseUrl.'registrace/">zde</a>');
     
    6147<tr><th>Správa úètu</th><td>');
    6248echo('<a href="'.$BaseUrl.'minimanager/">zde</a>');
    63 echo('</td></tr>
     49echo('</td></tr>');
    6450<tr><th>Existuje dnù</th><td>');
    6551echo(round((time()-mktime (0,0,0,4,21,2007))/3600/24));
    6652echo('</td></tr>
    67 <tr><th>Úètù</th><td>');
    68 
    69 $Database->select_db('realmd');
    70 $Result = $Database->select('account', 'COUNT(*)');
    71 $Row = $Result->fetch_array();
    72 $AccountCount = $Row[0];
    73 echo($AccountCount);
    74 
    75 echo('</td></tr>
    76 <tr><th>Postav</th><td>');
    77 
    78 $Database->select_db('characters');
    79 $Result = $Database->select('characters', 'COUNT(*)');
    80 $Row = $Result->fetch_array();
    81 $CharactersCount = $Row[0];
    82 echo($CharactersCount);
    83 
    84 echo('</td></tr>
     53*/
     54echo('<tr><th>Úètù</th><td>'.$AccountCount.'</td></tr>
     55<tr><th>Postav</th><td>'.CharacterCount().'</td></tr>
     56<tr><th>Bì¾ících akcí</th><td><a href="'.$BaseUrl.'events.php">'.RunningEventCount().'</a></td></tr>
    8557</table>
    8658</div>
Note: See TracChangeset for help on using the changeset viewer.