Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. <?php
  2. $original_item = $_GET['item'];
  3. $item = str_replace("\"", "", $original_item);
  4. $item = str_replace("\'", "", $item);
  5. $item = str_replace("\\", "", $item);
  6. $backpack_item = str_replace(" ", "+", $item);
  7. $steam_item = str_replace(" ", "%20", $item);
  8. $html_file = file_get_contents("DeineAPI=$backpack_item");
  9. $texttosearch = "<div class='media-body'>\n \t\t\t\t\t<h5 class='media-heading'>$original_item</h5>\n\t\t\t\t\t\tLounge: ";
  10. $csgobackpack_pos = strpos($html_file, $texttosearch);
  11. if($csgobackpack_pos != false) {
  12. $html_money_to_end = substr($html_file, $csgobackpack_pos + strlen($texttosearch));
  13. $lowest_price = substr($html_money_to_end, 0,strpos($html_money_to_end, " "));
  14. }
  15. else {
  16. $link = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=".$steam_item;
  17. $string = file_get_contents($link);
  18. $obj = json_decode($string);
  19. if($obj->{'success'} == "0") die("0");
  20. $lowest_price = $obj->{'lowest_price'};
  21. $lowest_price[strlen($lowest_price)] = 0;
  22. $lowest_price = str_replace("$","",$lowest_price);
  23. $lowest_price = (float)($lowest_price);
  24. }
  25. @include_once ("set.php");
  26. $rs = mysql_query("SELECT * FROM items WHERE name='$item'");
  27. if(mysql_num_rows($rs) > 0) {
  28. $row = mysql_fetch_array($rs);
  29. if(time()-$row["lastupdate"] < 3600) die($row["cost"]);
  30. }
  31. mysql_query("DELETE FROM items WHERE name='$item'");
  32. mysql_query("INSERT INTO items (`name`,`cost`,`lastupdate`) VALUES ('$item','$lowest_price','".time()."')");
  33. echo $lowest_price;
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement