Advertisement
iPixel99

Untitled

Jun 15th, 2023
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="stylesheet" href="style.css">
  5. </head>
  6. <body>
  7. <?php
  8. // Conectare la baza de date
  9. $conn = mysqli_connect('astralis.neopanel.ro', 'u1364_lE1KjFQLK1', '=NH^1d3yP=@c7nCf8jNG87JO', 's1364_statsx');
  10.  
  11. // Verificare conexiune
  12. if (!$conn) {
  13. die('Conexiunea la baza de date a eșuat: ' . mysqli_connect_error());
  14. }
  15.  
  16. // Verificare dacă s-a specificat un ID de jucător în parametrii URL-ului
  17. if (isset($_GET['id'])) {
  18. // Obține ID-ul jucătorului din parametrii URL-ului
  19. $playerId = $_GET['id'];
  20.  
  21. // Interogare pentru a obține numele jucătorului din tabela "ultimate_stats" folosind ID-ul jucătorului
  22. $query = "SELECT name FROM ultimate_stats WHERE id = $playerId";
  23. $result = mysqli_query($conn, $query);
  24.  
  25. // Verificare rezultat interogare
  26. if (mysqli_num_rows($result) > 0) {
  27. $row = mysqli_fetch_assoc($result);
  28. $playerName = $row['name'];
  29.  
  30. // Afișare titlu și buton "Înapoi"
  31. echo '<h2>Detalii despre ' . $playerName . '</h2>';
  32. echo '<a href="index.php" class="button">Inapoi</a>';
  33.  
  34. // Interogare pentru a obține detaliile jucătorului din tabela "ultimate_stats_weapons" folosind ID-ul jucătorului
  35. $query = "SELECT * FROM ultimate_stats_weapons WHERE player_id = $playerId ORDER BY kills DESC";
  36. $result = mysqli_query($conn, $query);
  37.  
  38. // Verificare rezultat interogare
  39. if (mysqli_num_rows($result) > 0) {
  40. // Afișare tabel cu date
  41. echo '<table>';
  42. echo '<tr><th>Weapon</th><th>Kills</th><th>HS Kills</th>><th>Shots</th><th>Hits</th><th>Damage</th><th>Head</th><th>Chest</th><th>Stomach</th><th>Left arm</th><th>Right arm</th><th>Left leg</th><th>Right leg</th><th>Total</th></tr>';
  43.  
  44. while ($row = mysqli_fetch_assoc($result)) {
  45. echo '<tr>';
  46. echo '<td><img class="weapon-image" src="guns/' . $row['weapon'] . '.png" alt="' . $row['weapon'] . '"></td>';
  47. echo '<td>' . $row['kills'] . '</td>';
  48. echo '<td>' . $row['hs_kills'] . '</td>';
  49. echo '<td>' . $row['shots'] . '</td>';
  50. echo '<td>' . $row['hits'] . '</td>';
  51. echo '<td>' . $row['damage'] . '</td>';
  52. echo '<td>' . $row['h_1'] . '</td>';
  53. echo '<td>' . $row['h_2'] . '</td>';
  54. echo '<td>' . $row['h_3'] . '</td>';
  55. echo '<td>' . $row['h_4'] . '</td>';
  56. echo '<td>' . $row['h_5'] . '</td>';
  57. echo '<td>' . $row['h_6'] . '</td>';
  58. echo '<td>' . $row['h_7'] . '</td>';
  59. echo '<td>' . $row['h_0'] . '</td>';
  60.  
  61. echo '</tr>';
  62. }
  63.  
  64. echo '</table>';
  65. } else {
  66. echo 'Nu s-au găsit detalii pentru jucătorul selectat.';
  67. }
  68. } else {
  69. echo 'Nu s-au găsit informații despre jucătorul selectat.';
  70. }
  71. } else {
  72. echo 'Nu s-a specificat un ID de jucător.';
  73. }
  74.  
  75. // Închidere conexiune
  76. mysqli_close($conn);
  77. ?>
  78. </body>
  79. </html>
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement