Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <link rel="stylesheet" href="style.css">
- <style>
- body {
- background-color: #f0f0f0;
- }
- .skill-bar {
- width: 100%;
- height: 20px;
- background-color: #333;
- position: relative;
- }
- .skill-bar-fill {
- height: 100%;
- background-color: #4CAF50;
- width: <?php echo ($playerSkill / 10); ?>%;
- }
- .skill-bar-text {
- position: absolute;
- top: 0;
- left: 50%;
- transform: translateX(-50%);
- color: #333;
- }
- </style>
- </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());
- }
- // Verificare dacă s-a specificat un ID de jucător în parametrii URL-ului
- if (isset($_GET['id'])) {
- // Obține ID-ul jucătorului din parametrii URL-ului
- $playerId = $_GET['id'];
- // Interogare pentru a obține numele jucătorului și informații despre skill și time din tabela "ultimate_stats" folosind ID-ul jucătorului
- $query = "SELECT name, skill, time FROM ultimate_stats WHERE id = $playerId";
- $result = mysqli_query($conn, $query);
- // Verificare rezultat interogare
- if (mysqli_num_rows($result) > 0) {
- $row = mysqli_fetch_assoc($result);
- $playerName = $row['name'];
- $playerSkill = $row['skill'];
- $playerTime = $row['time'];
- // Afișare titlu și buton "Înapoi"
- echo '<h2>Detalii despre ' . $playerName . '</h2>';
- echo '<a href="index.php" class="button">Inapoi</a>';
- // Afișare tabel cu skill și time
- echo '<table>';
- echo '<tr><th>Skill</th><th>Time played</th></tr>';
- 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>';
- echo '</table>';
- // Interogare pentru a obține detaliile jucătorului din tabela "ultimate_stats_weapons" folosind ID-ul jucătorului
- $query = "SELECT * FROM ultimate_stats_weapons WHERE player_id = $playerId ORDER BY kills DESC";
- $result = mysqli_query($conn, $query);
- // Verificare rezultat interogare
- if (mysqli_num_rows($result) > 0) {
- // Afișare tabel cu date
- echo '<table>';
- 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>';
- while ($row = mysqli_fetch_assoc($result)) {
- echo '<tr>';
- echo '<td><img class="weapon-image" src="guns/' . $row['weapon'] . '.png" alt="' . $row['weapon'] . '"></td>';
- echo '<td>' . $row['kills'] . '</td>';
- echo '<td>' . $row['hs_kills'] . '</td>';
- echo '<td>' . $row['shots'] . '</td>';
- echo '<td>' . $row['hits'] . '</td>';
- echo '<td>' . $row['damage'] . '</td>';
- echo '<td>' . $row['h_1'] . '</td>';
- echo '<td>' . $row['h_2'] . '</td>';
- echo '<td>' . $row['h_3'] . '</td>';
- echo '<td>' . $row['h_4'] . '</td>';
- echo '<td>' . $row['h_5'] . '</td>';
- echo '<td>' . $row['h_6'] . '</td>';
- echo '<td>' . $row['h_7'] . '</td>';
- echo '<td>' . $row['h_0'] . '</td>';
- echo '</tr>';
- }
- echo '</table>';
- } else {
- echo 'Nu s-au găsit detalii pentru jucătorul selectat.';
- }
- } else {
- echo 'Nu s-au găsit informații despre jucătorul selectat.';
- }
- } else {
- echo 'Nu s-a specificat un ID de jucător.';
- }
- // Închidere conexiune
- mysqli_close($conn);
- 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