Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="style.css">
- <script>
- // Funcție pentru a trata evenimentul de clic pe un rând din tabel
- function handleRowClick(playerId) {
- // Redirecționează utilizatorul către pagina separată pentru a afișa informațiile complete despre jucător
- window.location.href = 'player_details.php?id=' + playerId;
- }
- </script>
- </head>
- <body>
- <?php
- // Conectare la baza de date
- $conn = mysqli_connect('astralis.neopanel.ro', 'u1364_lE1KjFQLK1', '=NH^1d3yP=@c7nCf8jNG87JO', 's1364_statsx');
- // Verificare conexiune
- if (!$conn) {
- die('Conexiunea la baza de date a eșuat: ' . mysqli_connect_error());
- }
- // Formula pentru sortare
- $formulaSort = "(kills - deaths - team_kills)";
- // Interogare pentru a obține toate datele din tabela "ultimate_stats", sortate în funcție de formula specificată
- $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";
- $result = mysqli_query($conn, $query);
- // Verificare rezultat interogare
- if (mysqli_num_rows($result) > 0) {
- // Afișare tabel cu date
- echo '<h2>Top Players - Romania Respawn - ..::Levels | XP | Shop::..</h2>';
- echo '<table>';
- 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>';
- $index = 1;
- while ($row = mysqli_fetch_assoc($result)) {
- echo '<tr class="player-row" data-player-id="' . $row['id'] . '" onclick="handleRowClick(' . $row['id'] . ')">';
- echo '<td>' . $index . '</td>';
- echo '<td>' . $row['name'] . '</td>';
- echo '<td>' . $row['kills'] . '</td>';
- echo '<td>' . $row['deaths'] . '</td>';
- echo '<td>' . $row['hs_kills'] . '</td>';
- echo '<td>' . $row['shots'] . '</td>';
- echo '<td>' . $row['hits'] . '</td>';
- echo '<td>' . $row['damage'] . '</td>';
- echo '<td>' . formatTime($row['time']) . '</td>';
- echo '</tr>';
- $index++;
- }
- echo '</table>';
- } else {
- echo 'Nu există date în baza de date.';
- }
- // Închidere conexiune
- mysqli_close($conn);
- // Funcție pentru formatarea timpului în format ore:minute:secunde
- function formatTime($time)
- {
- $seconds = $time % 60;
- $minutes = floor(($time % 3600) / 60);
- $hours = floor($time / 3600);
- return sprintf("%02d:%02d:%02d", $hours, $minutes, $seconds);
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement