Guest User

Untitled

a guest
May 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <?
  2. require "../config.php";
  3. include "../includes/func.php";
  4. $itemid = clean(abs($_GET['itemid']));
  5. $friendinfo = $_GET['friendinfo'];
  6. $session = $_SESSION['User'];
  7.  
  8. if (strlen($friendinfo) > 0 && strlen($friendinfo) != 7)
  9. {
  10. echo fail();
  11. exit;
  12. }
  13.  
  14. $result=mysql_query("SELECT TOP 1 * FROM items WHERE id = '$itemid' AND forsale = 1");
  15. $row=mysql_fetch_array($result);
  16.  
  17. $cash_query=mysql_query("SELECT balance FROM data WHERE username = '$session'");
  18. $cash_row_array=mysql_fetch_array($cash_query);
  19. $cash_count=$cash_row_array['balance'];
  20.  
  21. if($row['price_sale']!=null&&$row['price_sale']!=0)
  22. $item_price=$row['price_sale'];
  23. else
  24. $item_price=$row['price'];
  25.  
  26. if (isset($itemid)&&mysql_num_rows($result))
  27. {
  28. if ($cash_count >= $item_price)
  29. {
  30. if (updateCash($cash_count-$item_price))
  31. {
  32. if ($send)
  33. {
  34. PurchaseCount($itemid);
  35. }
  36. else
  37. {
  38. updateCash($cash_count);
  39. echo fail($itemid);
  40. }
  41. }
  42. else
  43. echo fail($itemid);
  44. }
  45. else
  46. echo fail($itemid);
  47. }
  48. else
  49. echo fail();
  50. ?>
Add Comment
Please, Sign In to add comment