Advertisement
Guest User

Untitled

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