Advertisement
iPixel99

Untitled

Jun 16th, 2023
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.40 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="stylesheet" href="style.css">
  5. <style>
  6. body {
  7. background-color: #f0f0f0;
  8. }
  9.  
  10. .skill-bar {
  11. width: 100%;
  12. height: 20px;
  13. background-color: #333;
  14. position: relative;
  15. }
  16.  
  17. .skill-bar-fill {
  18. height: 100%;
  19. background-color: #4CAF50;
  20. width: <?php echo ($playerSkill / 10); ?>%;
  21. }
  22.  
  23. .skill-bar-text {
  24. position: absolute;
  25. top: 0;
  26. left: 50%;
  27. transform: translateX(-50%);
  28. color: #333;
  29. }
  30. </style>
  31.  
  32. </head>
  33. <body>
  34. <?php
  35. // Conectare la baza de date
  36. $conn = mysqli_connect('astralis.neopanel.ro', 'u1364_lE1KjFQLK1', '=NH^1d3yP=@c7nCf8jNG87JO', 's1364_statsx');
  37.  
  38. // Verificare conexiune
  39. if (!$conn) {
  40. die('Conexiunea la baza de date a eșuat: ' . mysqli_connect_error());
  41. }
  42.  
  43. // Verificare dacă s-a specificat un ID de jucător în parametrii URL-ului
  44. if (isset($_GET['id'])) {
  45. // Obține ID-ul jucătorului din parametrii URL-ului
  46. $playerId = $_GET['id'];
  47.  
  48. // Interogare pentru a obține numele jucătorului și informații despre skill și time din tabela "ultimate_stats" folosind ID-ul jucătorului
  49. $query = "SELECT name, skill, time FROM ultimate_stats WHERE id = $playerId";
  50. $result = mysqli_query($conn, $query);
  51.  
  52. // Verificare rezultat interogare
  53. if (mysqli_num_rows($result) > 0) {
  54. $row = mysqli_fetch_assoc($result);
  55. $playerName = $row['name'];
  56. $playerSkill = $row['skill'];
  57. $playerTime = $row['time'];
  58.  
  59. // Afișare titlu și buton "Înapoi"
  60. echo '<h2>Detalii despre ' . $playerName . '</h2>';
  61. echo '<a href="index.php" class="button">Inapoi</a>';
  62.  
  63. // Afișare tabel cu skill și time
  64. echo '<table>';
  65. echo '<tr><th>Skill</th><th>Time played</th></tr>';
  66. echo '<tr><td><div class="skill-bar"><div class="skill-bar-fill" style="width: ' . ($playerSkill / 10) . '%;"></div><span class="skill-bar-text">' . $playerSkill . '/1000</span></div></td><td>' . formatTime($playerTime) . '</td></tr>';
  67. echo '</table>';
  68.  
  69. // Interogare pentru a obține detaliile jucătorului din tabela "ultimate_stats_weapons" folosind ID-ul jucătorului
  70. $query = "SELECT * FROM ultimate_stats_weapons WHERE player_id = $playerId ORDER BY kills DESC";
  71. $result = mysqli_query($conn, $query);
  72.  
  73. // Verificare rezultat interogare
  74. if (mysqli_num_rows($result) > 0) {
  75. // Afișare tabel cu date
  76. echo '<table>';
  77. 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>';
  78.  
  79. while ($row = mysqli_fetch_assoc($result)) {
  80. echo '<tr>';
  81. echo '<td><img class="weapon-image" src="guns/' . $row['weapon'] . '.png" alt="' . $row['weapon'] . '"></td>';
  82. echo '<td>' . $row['kills'] . '</td>';
  83. echo '<td>' . $row['hs_kills'] . '</td>';
  84. echo '<td>' . $row['shots'] . '</td>';
  85. echo '<td>' . $row['hits'] . '</td>';
  86. echo '<td>' . $row['damage'] . '</td>';
  87. echo '<td>' . $row['h_1'] . '</td>';
  88. echo '<td>' . $row['h_2'] . '</td>';
  89. echo '<td>' . $row['h_3'] . '</td>';
  90. echo '<td>' . $row['h_4'] . '</td>';
  91. echo '<td>' . $row['h_5'] . '</td>';
  92. echo '<td>' . $row['h_6'] . '</td>';
  93. echo '<td>' . $row['h_7'] . '</td>';
  94. echo '<td>' . $row['h_0'] . '</td>';
  95. echo '</tr>';
  96. }
  97.  
  98. echo '</table>';
  99. } else {
  100. echo 'Nu s-au găsit detalii pentru jucătorul selectat.';
  101. }
  102. } else {
  103. echo 'Nu s-au găsit informații despre jucătorul selectat.';
  104. }
  105. } else {
  106. echo 'Nu s-a specificat un ID de jucător.';
  107. }
  108.  
  109. // Închidere conexiune
  110. mysqli_close($conn);
  111.  
  112. function formatTime($time)
  113. {
  114. $seconds = $time % 60;
  115. $minutes = floor(($time % 3600) / 60);
  116. $hours = floor($time / 3600);
  117.  
  118. return sprintf("%02d:%02d:%02d", $hours, $minutes, $seconds);
  119. }
  120. ?>
  121. </body>
  122. </html>
  123.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement