diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..64334d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/config/* diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..6fadb24 --- /dev/null +++ b/.htaccess @@ -0,0 +1,3 @@ + + deny from all + \ No newline at end of file diff --git a/README.md b/README.md index e5b0fb3..36ef709 100644 --- a/README.md +++ b/README.md @@ -1 +1,49 @@ -# pubg \ No newline at end of file +\`\`\`markdown +# DTCH - PUBG Clan User Stats + +This project displays the user statistics for members of the DTCH PUBG Clan. + +## Features + +1. Display lifetime stats for a specific game mode (solo, duo, squad). +2. Select a player from the DTCH clan and view their stats. +3. Display the PUBG API rate limit headers. + +## Prerequisites + +- PHP 7.4 or higher +- cURL extension for PHP + +## Installation + +1. Clone this repository: + \`\`\`bash + git clone [repository-url] + \`\`\` + +2. Navigate to the project directory: + \`\`\`bash + cd [project-directory] + \`\`\` + +3. Update the `config/config.php` file with the appropriate API key and clan members. + +4. Host the project on a PHP server (like Apache). + +5. Access the `user_stats.php` in your browser to view the stats. + +## Usage + +1. Select a game mode to view stats (solo, duo, squad). +2. Choose a clan member to view their specific stats. +3. The rate limit headers for the PUBG API are displayed at the top. + +## Notes + +- Ensure that the API key is kept confidential and not exposed to the public. +- The project comes with a rate limiter (`ratelimiter.php`), which can be included to restrict the frequency of page access. + +## License + +This project is open-source. Feel free to modify and distribute as per your needs. +\`\`\` diff --git a/clan_stats.php b/clan_stats.php new file mode 100644 index 0000000..3c5db12 --- /dev/null +++ b/clan_stats.php @@ -0,0 +1,60 @@ + + + + + + + + + + + DTCH - PUBG Clan - Clan Stats + + + + + + +
+
+

Clan Stats

+ "; + echo "AttributeValue"; + foreach ($clan['data']['attributes'] as $key => $value) { + echo "" . htmlspecialchars($key) . "" . htmlspecialchars($value) . ""; + } + echo ""; + } else { + echo "

No clan attributes available

"; + } + + + ?> +
+
+ + + + + diff --git a/includes/footer.php b/includes/footer.php new file mode 100644 index 0000000..6c20c21 --- /dev/null +++ b/includes/footer.php @@ -0,0 +1,3 @@ + diff --git a/includes/navigation.php b/includes/navigation.php new file mode 100644 index 0000000..6e22e4d --- /dev/null +++ b/includes/navigation.php @@ -0,0 +1,7 @@ + diff --git a/includes/ratelimiter.php b/includes/ratelimiter.php new file mode 100644 index 0000000..eb83635 --- /dev/null +++ b/includes/ratelimiter.php @@ -0,0 +1,41 @@ + $timestamp) { + if ($now - $timestamp > $allowed_time) { + unset($_SESSION['access_times'][$key]); + } +} + + +if (count($_SESSION['access_times']) > $allowed_refreshes) { + die(' + + + + + + RustAGHH + + +

RUSTAAAGGHHHH je mag de pagina niet vaker dan ' . $allowed_refreshes . 'x per ' . $allowed_time . ' seconde refreshen. Over een paar seconde word je weet terug geleid

+ + +'); +} + + +?> diff --git a/includes/styles.css b/includes/styles.css new file mode 100644 index 0000000..bf47810 --- /dev/null +++ b/includes/styles.css @@ -0,0 +1,100 @@ +/* Reset some default styles */ +body, h1, h2, p, ul, li, a { + margin: 0; + padding: 0; + text-decoration: none; +} + +body { + font-family: Arial, sans-serif; + background-color: black; + color: white; +} + +nav { + background-color: #333; +} + +nav ul { + list-style-type: none; + padding: 0; +} + +nav li { + display: inline-block; + margin-right: 10px; +} + +nav li:last-child { + margin-right: 0; +} + +nav a { + color: white; + padding: 10px 15px; + display: block; +} + +nav a:hover { + background-color: #555; +} + +header, main, footer { + max-width: 800px; + margin: 20px auto; + padding: 10px 20px; + border: 1px solid white; +} + +header h1, section h2 { + border-bottom: 1px solid white; + margin-bottom: 10px; + padding-bottom: 5px; +} + +footer { + text-align: center; +} + +/* Responsive Styles */ +@media (max-width: 600px) { + nav li { + display: block; + margin-right: 0; + } +} + +table { + width: 100%; + border-collapse: collapse; + margin-top: 20px; +} + +table, th, td { + border: 1px solid white; +} + +th, td { + padding: 10px; + text-align: left; +} + +th { + background-color: #555; +} + +tr:hover { + background-color: #444; +} + +.discord-logo { + width: 50px; /* Reduced from 50px to 30px */ + height: auto; + margin-top: 10px; + cursor: pointer; + transition: opacity 0.3s; +} + +.discord-logo:hover { + opacity: 0.8; +} \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..6437b69 --- /dev/null +++ b/index.php @@ -0,0 +1,30 @@ + + + + + + + DTCH - PUBG Clan + + + + + +
+

Welcome to DTCH - PUBG Clan

+
+ +
+
+

Welcome to DTCH - PUBG Clan

+

Join us on our Discord:

+ + + +
+
+ + + + + diff --git a/media/discordlogo.png b/media/discordlogo.png new file mode 100644 index 0000000..526669b Binary files /dev/null and b/media/discordlogo.png differ diff --git a/phpinfo.php b/phpinfo.php new file mode 100644 index 0000000..968c8df --- /dev/null +++ b/phpinfo.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/user_stats.php b/user_stats.php new file mode 100644 index 0000000..7354b4b --- /dev/null +++ b/user_stats.php @@ -0,0 +1,97 @@ + + + + + + + + + + + DTCH - PUBG Clan - User Stats + + + + + + +
+
+

User Stats

+ + + + +
"; + +// Buttons for each player +echo "
"; +foreach ($clanmembers as $player) { + echo ""; +} +echo "

"; + +$selected_player = $_POST['selected_player'] ?? $clanmembers[0]; + +// Retrieve user IDs +$players_url = "https://api.pubg.com/shards/steam/players?filter[playerNames]=$selected_player"; +$ch = curl_init(); +curl_setopt($ch, CURLOPT_URL, $players_url); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); +curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); +$players_response = curl_exec($ch); +curl_close($ch); +$players_data = json_decode($players_response, true); + +if (isset($players_data['data'])) { + $player = $players_data['data'][0]; + $player_id = $player['id']; + $player_name = $player['attributes']['name']; + + // Retrieve lifetime stats + $lifetime_url = "https://api.pubg.com/shards/steam/players/$player_id/seasons/lifetime?filter[gamepad]=false"; + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $lifetime_url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + $lifetime_response = curl_exec($ch); + curl_close($ch); + $lifetime_data = json_decode($lifetime_response, true); + + if (isset($lifetime_data['data']['attributes']['gameModeStats'][$selected_mode])) { + $stats = $lifetime_data['data']['attributes']['gameModeStats'][$selected_mode]; + echo "

" . ucfirst($selected_mode) . " Lifetime Stats for $player_name

"; + echo ""; + echo ""; + foreach ($stats as $stat_name => $stat_value) { + echo ""; + } + echo "
Stat NameValue
$stat_name$stat_value

"; + } +} else { + echo "No player data available."; +} +?> +
+
+ + + + +