Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. $item = $_GET['item'];
  2. $item = str_replace(""", "", $item);
  3. $item = str_replace("'", "", $item);
  4. $item = str_replace(" ", "%20", $item);
  5. $item = str_replace("\", "", $item);
  6. @include_once ("set.php");
  7. $rs = mysql_query("SELECT * FROM items WHERE name='$item'");
  8. if(mysql_num_rows($rs) > 0) {
  9. $row = mysql_fetch_array($rs);
  10. if(time()-$row["lastupdate"] < 604800) die($row["cost"]);
  11. }
  12. $link = "http://steamcommunity.com/market/priceoverview/?currency=1&appid=730&market_hash_name=".$item;
  13. $string = file_get_contents($link);
  14. $obj = json_decode($string, true);
  15. if($obj['success'] == "0") die("notfound");
  16. $lowest_price = $obj['lowest_price'];
  17. echo $obj->['lowest_price'];
  18. for($i = 5; $i < strlen($lowest_price); $i++) {
  19. $lowest_price[$i-5] = $lowest_price[$i];
  20. }
  21. $lowest_price[strlen($lowest_price)] = 0;
  22. $lowest_price = (float)($lowest_price);
  23. mysql_query("DELETE FROM items WHERE name='$item'");
  24. mysql_query("INSERT INTO items (`name`,`cost`,`lastupdate`) VALUES ('$item','$lowest_price','".time()."')");
  25. echo $link;
  26. echo $lowest_price;
  27. echo ' test ';
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement