Advertisement
iPixel99

Untitled

Jun 16th, 2023
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="stylesheet" href="style.css">
  5. <script>
  6. // Funcție pentru a trata evenimentul de clic pe un rând din tabel
  7. function handleRowClick(playerId) {
  8. // Redirecționează utilizatorul către pagina separată pentru a afișa informațiile complete despre jucător
  9. window.location.href = 'player_details.php?id=' + playerId;
  10. }
  11. </script>
  12. </head>
  13. <body>
  14. <?php
  15. // Conectare la baza de date
  16. $conn = mysqli_connect('astralis.neopanel.ro', 'u1364_lE1KjFQLK1', '=NH^1d3yP=@c7nCf8jNG87JO', 's1364_statsx');
  17.  
  18. // Verificare conexiune
  19. if (!$conn) {
  20. die('Conexiunea la baza de date a eșuat: ' . mysqli_connect_error());
  21. }
  22.  
  23. // Formula pentru sortare
  24. $formulaSort = "(kills - deaths - team_kills)";
  25.  
  26. // Interogare pentru a obține toate datele din tabela "ultimate_stats", sortate în funcție de formula specificată
  27. $query = "SELECT id, name, kills, deaths, hs_kills, assists, revenges, shots, hits, damage, time, skill FROM ultimate_stats ORDER BY {$formulaSort} DESC, kills DESC, hs_kills DESC LIMIT 100";
  28. $result = mysqli_query($conn, $query);
  29.  
  30. // Verificare rezultat interogare
  31. if (mysqli_num_rows($result) > 0) {
  32. // Afișare tabel cu date
  33. echo '<h2>Top Players - Romania Respawn - ..::Levels | XP | Shop::..</h2>';
  34. echo '<table>';
  35. echo '<tr><th>#</th><th>Name</th><th>Kills</th><th>Deaths</th><th>HS Kills</th><th>Shots</th><th>Hits</th><th>Damage</th><th>Time</th></tr>';
  36.  
  37. $index = 1;
  38. while ($row = mysqli_fetch_assoc($result)) {
  39. echo '<tr class="player-row" data-player-id="' . $row['id'] . '" onclick="handleRowClick(' . $row['id'] . ')">';
  40. echo '<td>' . $index . '</td>';
  41. echo '<td>' . $row['name'] . '</td>';
  42. echo '<td>' . $row['kills'] . '</td>';
  43. echo '<td>' . $row['deaths'] . '</td>';
  44. echo '<td>' . $row['hs_kills'] . '</td>';
  45. echo '<td>' . $row['shots'] . '</td>';
  46. echo '<td>' . $row['hits'] . '</td>';
  47. echo '<td>' . $row['damage'] . '</td>';
  48. echo '<td>' . formatTime($row['time']) . '</td>';
  49. echo '</tr>';
  50.  
  51. $index++;
  52. }
  53.  
  54. echo '</table>';
  55. } else {
  56. echo 'Nu există date în baza de date.';
  57. }
  58.  
  59. // Închidere conexiune
  60. mysqli_close($conn);
  61.  
  62. // Funcție pentru formatarea timpului în format ore:minute:secunde
  63. function formatTime($time)
  64. {
  65. $seconds = $time % 60;
  66. $minutes = floor(($time % 3600) / 60);
  67. $hours = floor($time / 3600);
  68.  
  69. return sprintf("%02d:%02d:%02d", $hours, $minutes, $seconds);
  70. }
  71. ?>
  72. </body>
  73. </html>
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement