Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---|| ALL OF THE PHP IN WEBSPY index.php ||---
- }
- $_SESSION['loggedin'] = 1;
- include "config.php";
- error_reporting(0);
- header('Content-Type: text/html; charset=utf-8');
- $cachefolder = getcwd() . "/../history";
- if (!file_exists($cachefolder)) {
- $old_umask = umask(0);
- mkdir($cachefolder, 0775);
- umask($old_umask);
- }
- if (isset($_GET["download"])) {
- $file = $_GET["file"];
- if (file_exists($file) && is_readable($file)) {
- if (preg_match('/\.jpg$/',$file)) {
- header('Content-Description: File Transfer');
- header('Content-Type: application/octet-stream');
- header('Content-Disposition: attachment; filename="'.basename($file).'"');
- header('Content-Length: ' . filesize($file));
- readfile($file);
- }
- }
- }
- if ($_GET["metadata"] == "true") {
- if ($_GET["PrivateKey"] == $PrivateKey) {
- $file = fopen("../history/metadata_us1.json", "w");
- fwrite($file, $_POST["metadata"]);
- echo "Error.MetadataWriteSuccessful";
- exit;
- } else {
- echo "Error.PrivateKeyMismatch";
- exit;
- }
- }
- if ($_GET["upload"] == "true") {
- if ($_GET["PrivateKey"] == $PrivateKey) {
- if (is_uploaded_file($_FILES['file']['tmp_name']))
- {
- $folder_name = $cachefolder . "/" . str_replace(".jpg", "", $_FILES['file']['name']);
- if (!file_exists($folder_name)) {
- mkdir($folder_name);
- }
- /* Move uploaded files */
- if (move_uploaded_file($_FILES['file']['tmp_name'], $folder_name . "/" . date("Y-n-j_G-i-s") . ".jpg")) {
- echo "Error.UploadDone";
- } else {
- echo "Error.UploadFailed";
- }
- } else {
- echo $_FILES['file']['error'];
- echo "Error.UploadFailed";
- }
- } else {
- return "Error.PrivateKeyMismatch";
- }
- exit;
- } elseif ($_GET["delete"] == "true") {
- echo $_GET["file"];
- if ($_GET["PrivateKey"] == $PrivateKey) {
- if (isset($_GET["file"])) {
- if (unlink($cachefolder . "/" . $_GET["file"])) {
- echo "Error.DeleteSuccessful";
- } else {
- echo "Error.DeleteNotSuccessful";
- }
- } else {
- echo "Error.FileNotSpecified";
- }
- } else {
- echo "Error.PrivateKeyMismatch";
- }
- exit;
- } else {
- $generate = 1;
- header("Access-Control-Allow-Origin: \"http://old.linhy.cz\"");
- }
- ?>
- <?php
- if ($generate == 1) {
- $steamid = "";
- /* Reading metadata from file */
- $file = fopen("../history/metadata_us1.json", "r");
- $metadata_json = fread($file, filesize("../history/metadata_us1.json"));
- $metadata_json = json_decode($metadata_json, true);
- foreach ($metadata_json['players'] as $item) {
- $metadata[$item['steamid']]['name'] = $item['name'];
- $metadata[$item['steamid']]['timestamp'] = $item['timestamp'];
- $metadata[$item['steamid']]['serverid'] = $item['serverid'];
- }
- /* End reading metadata from file */
- foreach ($metadata as $file => $temp) {
- $steamid .= $file . ",";
- }
- /* Global player stats */
- $url = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . $SteamAPI_Key . '&steamids=' . $steamid;
- $cURL = curl_init();
- curl_setopt($cURL, CURLOPT_URL, $url);
- curl_setopt($cURL, CURLOPT_HTTPGET, true);
- curl_setopt($cURL, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Accept: application/json'
- ));
- $result = curl_exec($cURL);
- $json = json_decode($result, true);
- foreach($json['response']['players'] as $item) {
- $globalstats[$item['steamid']] .= '"profileurl":"' . $item['profileurl'] . '",';
- $globalstats[$item['steamid']] .= '"avatar":"' . $item['avatarmedium'] . '",';
- if($item['personastate'] == 0) {
- $personastate = '"personastate":"Offline",';
- } elseif($item['personastate'] == 1) {
- $personastate = '"personastate":"Online",';
- } elseif($item['personastate'] == 2) {
- $personastate = '"personastate":"Busy",';
- } elseif($item['personastate'] == 3) {
- $personastate = '"personastate":"Away",';
- } elseif($item['personastate'] == 4) {
- $personastate = '"personastate":"Snooze",';
- } elseif($item['personastate'] == 5) {
- $personastate = '"personastate":"Looking to trade",';
- } elseif($item['personastate'] == 6) {
- $personastate = '"personastate":"Looking to play",';
- }
- if ($item['communityvisibilitystate'] == 3) {
- $globalstats[$item['steamid']] .= '"communitystate":"Public",';
- } else {
- $globalstats[$item['steamid']] .= '"communitystate":"Private",';
- }
- $globalstats[$item['steamid']] .= '"lastlogoff":"' . $item['lastlogoff'] . '",';
- if (isset($item['gameextrainfo'])) {
- $personastate = '"personastate": "Playing ' . $item['gameextrainfo'] . '",';
- }
- $globalstats[$item['steamid']] .= $personastate;
- if (isset($item['gameserverip'])) {
- $globalstats[$item['steamid']] .= '"gameserverip":"' . $item['gameserverip'] . '",';
- }
- }
- /* Global player stats end */
- /* Player bans */
- $url = 'http://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?key=' . $SteamAPI_Key . '&steamids=' . $steamid;
- $cURL = curl_init();
- curl_setopt($cURL, CURLOPT_URL, $url);
- curl_setopt($cURL, CURLOPT_HTTPGET, true);
- curl_setopt($cURL, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Accept: application/json'
- ));
- $result = curl_exec($cURL);
- $json = json_decode($result, true);
- foreach($json['players'] as $item) {
- $com_ban = ($item['CommunityBanned']) ? 'true' : 'false';
- $globalstats[$item['SteamId']] .= '"CommunityBanned":"' . $com_ban . "\",";
- $vac_ban = ($item['VACBanned']) ? 'true' : 'false';
- $globalstats[$item['SteamId']] .= '"VACBanned":"' . $vac_ban . "\",";
- $globalstats[$item['SteamId']] .= '"NumberOfVACBans":"' . $item['NumberOfVACBans'] . "\",";
- $globalstats[$item['SteamId']] .= '"DaysSinceLastBan":"' . $item['DaysSinceLastBan'] . "\",";
- $globalstats[$item['SteamId']] .= '"NumberOfGameBans":"' . $item['NumberOfGameBans'] . "\",";
- $globalstats[$item['SteamId']] .= '"EconomyBan":"' . $item['EconomyBan'] . "\",";
- }
- /* Player bans end */
- $check = 0;
- foreach ($metadata as $file => $temp) {
- $check = 1;
- $file .= ".jpg";
- echo "<div class=\"imgdiv\"><img class=\"spyimage\" src=\"" . getfile($file) . "\"><span class=\"playerinfo\"><span class=\"player_name_raw\">" . $metadata[str_replace(".jpg", "", $file)]['name'] . "</span><br>SteamID64: <span class=\"steamid_raw\">" . str_replace(".jpg", "", $file) . "</span><br><a class=\"more_info_button\" href=\"#\">More info</a></span><span class=\"hidden_data\" style=\"display: none\">" . getInfo(str_replace(".jpg", "", $file)) . "</span></div>";
- }
- if ($check == 0) {
- echo "<center><span class=\"no_players\">No players are online, or there was a problem initializing.</span></center>";
- }
- }
- function getFile($file) {
- global $cachefolder;
- $files = scandir($cachefolder . "/" . str_replace(".jpg", "", $file));
- $file_count = count($files);
- return "../history/" . str_replace(".jpg", "", $file) . "/" . $files[$file_count - 1];
- }
- function getInfo($steamid) {
- global $SteamAPI_Key;
- global $globalstats;
- global $metadata;
- $return = "{" . $globalstats[$steamid];
- /* Unturned Playtime */
- $url = 'http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=' . $SteamAPI_Key . '&steamid=' . $steamid . "&format=json";
- $cURL = curl_init();
- curl_setopt($cURL, CURLOPT_URL, $url);
- curl_setopt($cURL, CURLOPT_HTTPGET, true);
- curl_setopt($cURL, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($cURL, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Accept: application/json'
- ));
- $result = curl_exec($cURL);
- $json = json_decode($result, true);
- foreach($json['response']['games'] as $item) {
- if ($item['appid'] == 304930) {
- if (isset($item['playtime_2weeks'])) {
- $return .= '"playtime_2weeks":"' . $item['playtime_2weeks'] / 60 . ' hours",';
- }
- $return .= '"playtime_total":"' . $item['playtime_forever'] / 60 . ' hours",';
- }
- }
- $return .= '"screenshot_time":"' . $metadata[$steamid]['timestamp'] . '",';
- $return .= '"serverid":"' . $metadata[$steamid]['serverid'] . '"';
- return $return . "}";
- }
- ?>
- <script type="text/javascript">
- $(".more_info_button").click(function(e) {
- e.preventDefault();
- var img_url = $(e.target).parent().siblings(".spyimage").attr("src");
- $(".big_image").attr("src", img_url);
- $(".player_name").html($(e.target).siblings(".player_name_raw").html());
- $(".file_download").attr("href", "?download&file=" + img_url);
- $(".more_info_overlay").css("display", "block");
- $(".big_image").css("margin-top", ($(".more_info_overlay_black").outerHeight() - $(".big_image").outerHeight()) / 2 + "px");
- var data = $(e.target).parent().siblings(".hidden_data").html();
- var json = jQuery.parseJSON(data);
- $(".player_name_url").attr("href", json.profileurl);
- if (json.gameserverip === undefined) {
- $(".status").html(json.personastate);
- } else {
- $(".status").html(json.personastate + ' <a href="steam://connect/' + json.gameserverip + '" id="game_url">Connect</a>');
- }
- $(".debug").html("Debugging information: " + data);
- });
- $(".more_info_overlay").click(function(e) {
- if ($(e.target).is('.more_info_overlay')) {
- e.preventDefault();
- $(".more_info_overlay").css("display", "none");
- }
- });
- $(".close_overlay").click(function(e) {
- if ($(e.target).is('.close_overlay')) {
- e.preventDefault();
- $(".more_info_overlay").css("display", "none");
- }
- });
- $(document).keydown(function(e) {
- if ($(".more_info_overlay").css("display") == "block" && e.which == 27) {
- $(".more_info_overlay").css("display", "none");
- };
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment