Advertisement
Kimeraweb

Untitled

Jul 1st, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. <?php
  2. function getTime($tiempo)
  3. {
  4.     $dias = 0; $horas = 0; $minutos = 0; $segundos = 0;
  5.     while ($tiempo>86400)
  6.     {
  7.         $tiempo -= 86400;
  8.         $dias ++;
  9.     }
  10.    
  11.     while ($tiempo>3600)
  12.     {
  13.         $tiempo -= 3600;
  14.         $horas ++;
  15.     }
  16.    
  17.     while ($tiempo>60)
  18.     {
  19.         $tiempo -= 60;
  20.         $minutos++;
  21.     }
  22.    
  23.     $resultado = $dias." dias, ".$horas." horas, ".$minutos." minutos y ".$tiempo." segundos.";
  24.     return $resultado;
  25. }
  26.  
  27. mysqli_connect("127.0.0.1","root","","unturned") or DIE ("No se pudo establecer conexion con el servidor.");
  28.  
  29.  
  30. $query = mysqli_query("Select * from ranks order by points Desc limit 10");
  31.  
  32. $colores = array("0" => "#DDDDDD", "1" => "#008800");
  33. $contador = 0;
  34.  
  35. echo "<FONT FACE='courier'>";
  36. echo "<table border='1'>";
  37. echo "<tr><td>Name</td><td>Points</td><td>Balance</td><td>Total Play Time</td></tr>";
  38. while ($a=mysqli_fetch_array($query))
  39. {
  40.     // Player info
  41.     $playerInfo = mysqli_fetch_array(mysqli_query("Select * from playerinfo where SteamID=".$a['steamId']));
  42.     // Uconomy
  43.     $uconomy = mysqli_fetch_array(mysqli_query("Select * from uconomy where SteamID=".$a['steamId']));
  44.     echo "<tr><td bgcolor=".$colores[($contador%2)].">".$a['lastDisplayName']."</td><td>".$a['points']."</td><td>".$uconomy['balance']."&#8364;</td><td>".getTime($playerInfo['TotalPlayTime'])."</td></tr>";
  45.     $contador++;
  46. }
  47.  
  48. echo "</table>";
  49. echo "</font>";
  50.  
  51.  
  52. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement