Ignore:
Timestamp:
May 18, 2009, 9:01:38 PM (16 years ago)
Author:
george
Message:
  • Upraveno: Stránka Top hráči poopravena.
  • Přidáno: Datum založení serveru.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pages/tophraci.php

    r588 r589  
    11<?php
    22$top = 40; //kolik nejlepších
    3 $connect = mysql_pconnect($db_server, $db_user, $db_pass)  or die ("Spojení se serverem $ip nebylo uspesne");
    43
    54function getTime($total)
    65{
    7   $dny = (int)($total/86400);
    8   $total = $total - ($dny*86400);
    9   $hodiny = (int)($total/3600);
    10   $total = $total - ($hodiny*3600);
    11   $minuty = (int)($total/60);
     6  $dny = (int)($total / 86400);
     7  $total = $total - ($dny * 86400);
     8  $hodiny = (int)($total / 3600);
     9  $total = $total - ($hodiny * 3600);
     10  $minuty = (int)($total / 60);
    1211
    13   $cas = $dny."d ".$hodiny."h ".$minuty."m";
    14   return $cas;
     12  $cas = $dny.'d '.$hodiny.'h '.$minuty.'m';
     13  return($cas);
    1514}
    1615
     
    1918{
    2019  if ($online == 1):
    21     $status = "<font color=green>Online</font>";
     20    $status = '<span style="color: green;">Online</span>';
    2221  else:
    23     $status = "<font color=red>Offline</font>";
     22    $status = '<span style="color: red;">Offline</span>';
    2423  endif;
    2524 
    26   return $status;
     25  return($status);
    2726}
    2827
     28$db->select_db($Config['Mangos']['DatabaseCharacters']);
     29$sql = 'SELECT name, totaltime, online FROM characters ORDER BY totaltime DESC LIMIT '.$top;
     30$result = $db->query($sql);
    2931
    30 mysql_select_db($db_characters, $connect);
     32$i = 0;
     33echo('<h3 class="PageTitle">Nejlepších '.$top.' herních časů</h3>');
    3134
    32 
    33 $sql = "SELECT * FROM characters ORDER BY totaltime DESC LIMIT $top";
    34 $result = mysql_query($sql);
    35 
    36 
    37 $i=0;
    38 
    39 
    40 echo "<center><h2> Nejlepších $top herních časů</h2>
    41       <table>";
    42      
    43 
    44 while ($vypis=mysql_fetch_array($result))
     35echo('<table class="SimpleTable">');     
     36while($vypis = $result->fetch_assoc())
    4537{   
    46   $i=$i+1;
    47   echo "<tr><td>$i)<th>".$vypis['name']."</th>
    48         <td>".getTime($vypis['totaltime'])."</td>
    49         <td>".getOnline($vypis['online'])."</td></tr>";
     38  $i = $i + 1;
     39  echo('<tr><td>'.$i.')<th>'.$vypis['name'].'</th>
     40        <td>'.getTime($vypis['totaltime']).'</td>
     41        <td>'.getOnline($vypis['online']).'</td></tr>');
    5042
    5143}
    52 
    53 
    54 echo "<center></table>";
    55 
    56 
    57 mysql_close();
     44echo('</table>');
    5845
    5946?>
Note: See TracChangeset for help on using the changeset viewer.