Changeset 589 for trunk/pages/tophraci.php
- Timestamp:
- May 18, 2009, 9:01:38 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/pages/tophraci.php
r588 r589 1 1 <?php 2 2 $top = 40; //kolik nejlepších 3 $connect = mysql_pconnect($db_server, $db_user, $db_pass) or die ("Spojení se serverem $ip nebylo uspesne");4 3 5 4 function getTime($total) 6 5 { 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); 12 11 13 $cas = $dny. "d ".$hodiny."h ".$minuty."m";14 return $cas;12 $cas = $dny.'d '.$hodiny.'h '.$minuty.'m'; 13 return($cas); 15 14 } 16 15 … … 19 18 { 20 19 if ($online == 1): 21 $status = "<font color=green>Online</font>";20 $status = '<span style="color: green;">Online</span>'; 22 21 else: 23 $status = "<font color=red>Offline</font>";22 $status = '<span style="color: red;">Offline</span>'; 24 23 endif; 25 24 26 return $status;25 return($status); 27 26 } 28 27 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); 29 31 30 mysql_select_db($db_characters, $connect); 32 $i = 0; 33 echo('<h3 class="PageTitle">Nejlepších '.$top.' herních časů</h3>'); 31 34 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)) 35 echo('<table class="SimpleTable">'); 36 while($vypis = $result->fetch_assoc()) 45 37 { 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>'); 50 42 51 43 } 52 53 54 echo "<center></table>"; 55 56 57 mysql_close(); 44 echo('</table>'); 58 45 59 46 ?>
Note:
See TracChangeset
for help on using the changeset viewer.