Advertisement
SilentLtu

dasda

May 27th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. <?php
  2. include'../pages/donate/conn.php';
  3. // Loop through cart items and add each to related order_items table
  4. foreach($cart_items as $cart_item)
  5. {
  6. $cart_item_data['order_id'] = $order_id;
  7. $cart_item_data['subscr_id'] = $subscr_id;
  8. $cart_item_data['item_name'] = $cart_item['item_name'];
  9. $cart_item_data['item_number'] = $cart_item['item_number'];
  10. $cart_item_data['os0'] = $cart_item['option_selection1'];
  11. $cart_item_data['on0'] = $cart_item['option_name1'];
  12. $cart_item_data['os1'] = $cart_item['option_selection2'];
  13. $cart_item_data['on1'] = $cart_item['option_name2'];
  14. $cart_item_data['os2'] = $cart_item['option_selection3'];
  15. $cart_item_data['on2'] = $cart_item['option_name3'];
  16. $cart_item_data['os3'] = $cart_item['option_selection4'];
  17. $cart_item_data['on3'] = $cart_item['option_name4'];
  18. $cart_item_data['os4'] = $cart_item['option_selection5'];
  19. $cart_item_data['on4'] = $cart_item['option_name5'];
  20. $cart_item_data['os5'] = $cart_item['option_selection6'];
  21. $cart_item_data['on5'] = $cart_item['option_name6'];
  22. $cart_item_data['os6'] = $cart_item['option_selection7'];
  23. $cart_item_data['on6'] = $cart_item['option_name7'];
  24. $cart_item_data['os7'] = $cart_item['option_selection8'];
  25. $cart_item_data['on7'] = $cart_item['option_name8'];
  26. $cart_item_data['os8'] = $cart_item['option_selection9'];
  27. $cart_item_data['on8'] = $cart_item['option_name9'];
  28. $cart_item_data['quantity'] = $cart_item['quantity'];
  29. $cart_item_data['custom'] = $cart_item['custom'];
  30. $cart_item_data['mc_gross'] = $cart_item['mc_gross'];
  31. $cart_item_data['mc_handling'] = $cart_item['mc_handling'];
  32. $cart_item_data['mc_shipping'] = $cart_item['mc_shipping'];
  33. $cart_item_data['raw_log_id'] = $ipn_log_data_id;
  34. $cart_item_data['btn_id'] = $cart_item['btn_id'];
  35. echo "Not Enough NCoins";
  36.  
  37. $price = 0;
  38. $ammount = 0;
  39. switch ($cart_item_data['os0']){
  40. case "1":
  41. $price = 50;
  42. $ammount = 1;
  43. break;
  44. case "3":
  45. $price = 100;
  46. $ammount = 3;
  47. break;
  48. case "7":
  49. $price = 200;
  50. $ammount = 7;
  51. break;
  52. case "15":
  53. $price = 400;
  54. $ammount = 15;
  55. break;
  56. case "30":
  57. $price = 800;
  58. $ammount = 30;
  59. break;
  60. default:
  61. break;
  62. }
  63.  
  64. $char = $cart_item_data['on1'];
  65. echo "Not Enough NCoins";
  66. //==============================================================
  67.  
  68. ////prime points fetch/////";
  69. $sql=("SELECT * FROM account_gsdata WHERE account_name="$_SESSION['acc']" AND var='PRIME_POINTS'");
  70. $query= mysqli_query($link , $sql) or die();
  71. while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC))
  72. {
  73. $money=$row['value'];
  74. $acc=$row['account_name'];
  75. }
  76.  
  77. //character id and name fetch/////"
  78. $sql1=("SELECT * FROM characters WHERE account_name="$_SESSION['acc']" AND char_name='$char'");
  79. $query1= mysqli_query($link , $sql1) or die();
  80. while ($row1 = mysqli_fetch_array($query1, MYSQLI_ASSOC))
  81. {
  82. $charId=$row1['charId'];
  83. }
  84. ////premium coin id and amount in character fetch/////
  85. $sql2=("SELECT * FROM items WHERE owner_id='$charId' AND item_id='27659'");
  86. $query2= mysqli_query($link , $sql2) or die();
  87. while ($row2 = mysqli_fetch_array($query2, MYSQLI_ASSOC))
  88. {
  89. $itemId=$row2['item_id'];
  90. $pcbal=$row2['count'];
  91. }
  92.  
  93.  
  94.  
  95.  
  96. // Checking does player have enough Ncoins
  97. $sql5=("SELECT * FROM account_gsdata WHERE account_name='$_SESSION' AND var='PRIME_POINTS'");
  98. $query= mysqli_query($link , $sql5) or die();
  99. if($money >= $price){
  100. //Calculating and collecting ncoins
  101. $lastBal=$money-$price;
  102. $sql4 ="UPDATE account_gsdata SET value = $lastBal WHERE account_name='$_SESSION' AND var='PRIME_POINTS'";
  103. if (mysqli_query($link, $sql4)) {}
  104. else {}
  105. //Inserting coins for player
  106. $sql3 = "INSERT INTO items (owner_id, item_id, count, enchant_level, loc, loc_data, time_of_use,
  107. custom_type1, custom_type2, mana_left, time)
  108. VALUES ($charId, '27659', $ammount, '0', 'INVENTORY', '1', NULL, '0', '0', '-1', '-1')";
  109. echo "</br>";
  110. if ($link->query($sql3) === TRUE) {
  111. echo "</br>";
  112. echo "Enough NCoins";}
  113.  
  114. else {}
  115. } elseif($money < $price) {
  116. echo "</br>";
  117. echo "Not Enough NCoins";
  118. };
  119.  
  120. $query = mysqli_query($link,$sql5);
  121.  
  122.  
  123.  
  124.  
  125. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement