Advertisement
Guest User

Untitled

a guest
Oct 27th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.09 KB | None | 0 0
  1. key=$key&action=add_order&service=$service&link=$link&quantity=$quantity";
  2.  
  3.  
  4. class Api
  5. {
  6. public $api_url = 'https://andremedia.co/api.php'; // API URL
  7.  
  8. public $api_key = 'KOyhuoE68pWzWOl7gIpT'; // Your API key
  9.  
  10. public function order($link, $type, $quantity) { // Add order
  11. return json_decode($this->connect(array(
  12. 'api' => $this->api_key,
  13. 'action' => 'add',
  14. 'link' => $link,
  15. 'service' => $type,
  16. 'quantity' => $quantity
  17. )));
  18. }
  19.  
  20. public function status($order_id) { // Get status, remains
  21. return json_decode($this->connect(array(
  22. 'api' => $this->api_key,
  23. 'action' => 'status',
  24. 'order_id' => $order_id
  25. )));
  26. }
  27.  
  28.  
  29. private function connect($post) {
  30. $_post = Array();
  31. if (is_array($post)) {
  32. foreach ($post as $name => $value) {
  33. $_post[] = $name.'='.urlencode($value);
  34. }
  35. }
  36. $ch = curl_init($this->api_url);
  37. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  38. curl_setopt($ch, CURLOPT_POST, 1);
  39. curl_setopt($ch, CURLOPT_HEADER, 0);
  40. curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  41. if (is_array($post)) {
  42. curl_setopt($ch, CURLOPT_POSTFIELDS, join('&', $_post));
  43. }
  44. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
  45. $result = curl_exec($ch);
  46. echo $result;
  47. if (curl_errno($ch) != 0 && empty($result)) {
  48. $result = false;
  49. }
  50. curl_close($ch);
  51. return $result;
  52. }
  53. }
  54.  
  55. // Examples
  56.  
  57. $api = new Api();
  58.  
  59. $order = $api->order('https://www.instagram.com/dhifoaksa/', '272', '100'); // $link, $type - service type, $quantity: return order id or Error
  60.  
  61. $status = $api->status($order->data->order_id);
  62.  
  63.  
  64. if ($provider == "ERMEDIA" AND $order->error) { ?>
  65. <div class="alert alert-danger"> <strong>Fiture Sedang Perbaikan.</strong></div>
  66. <? } else if ($order->result == "error") { ?>
  67. <div class="alert alert-danger"> <strong>Gagal: </strong> Fiture Maintenance </div>
  68. <? } else {
  69. if ($provider == "ERMEDIA") {
  70. $order_id = $order->data->order_id;
  71. } else if($provider == "MANUAL") {
  72. $order_id = rand(00000,9999);
  73. } else {
  74. $order_id = rand(0000,9999);
  75. }
  76. $send = mysql_query("UPDATE user SET balance = balance-$price WHERE username = '$username'");
  77. $send = mysql_query("UPDATE user SET balance_used = balance_used+$price WHERE username = '$username'");
  78. $send = mysql_query("INSERT INTO order_history(order_id,provider,buyer,service,link,quantity,price,status,date,time) VALUES ('$order_id','$provider','$username','$service','$link','$quantity','$price','Pending','$date','$time')");
  79. $send = mysql_query("INSERT INTO balance_history(username, action, quantity, msg, date, time) VALUES ('$username','Cut Balance','$price','User buy service. Order ID : $order_id','$date','$time')");
  80. if ($send) { ?>
  81. <div class="alert bg-danger">
  82. <font color="black">
  83. <strong>Order Request telah Berhasil, Silahkan cek riwayat history/orderan!: </strong><br />
  84. Order ID : ER-MEDIA-> <?php echo $order_id; ?><br />
  85. Service: <?php echo $service; ?><br />
  86. Target : <?php echo $link; ?><br />
  87. Quantity: <?php echo $quantity; ?><br />
  88. Cut Balance: <?php echo "Rp. " . number_format($price,0,",","."); ?><br />
  89. </font>
  90. </div>
  91. <? } else { ?>
  92. Database error!
  93. <? } } } } else { ?>
  94. <div class="alert bg-info"> <button type="button" class="close" data-dismiss="alert">
  95. <span aria-hidden="true">×</span>
  96. </button><div> <strong>*INFO: </strong> Sebelum order dimohon membaca peraturan yang ada, agar tidak terjadi kesalahan saat melakukan order. Kami tidak akan merefund order yang error karena kesalahan user. </div></div>
  97. <? } ?>
  98. <!-- Row-->
  99. <div class="row">
  100. <div class="col-sm-6">
  101. <div class="card">
  102. <div class="card-header bgm-cyan">
  103. <h2>New Order
  104. </h2>
  105.  
  106. <ul class="actions actions-alt">
  107. <li class="dropdown">
  108. <a href="" data-toggle="dropdown" aria-expanded="false">
  109. <i class="zmdi zmdi-more-vert"></i>
  110. </a>
  111.  
  112. <ul class="dropdown-menu dropdown-menu-right">
  113. <li>
  114. <a href="">Refresh</a>
  115. </li>
  116. <li>
  117. <a href="">Manage Widgets</a>
  118. </li>
  119. <li>
  120. <a href="">Widgets Settings</a>
  121. </li>
  122. </ul>
  123. </li>
  124. </ul>
  125. </div>
  126.  
  127. <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.js"></script>
  128. <script type="text/javascript">
  129. var htmlobjek;
  130. $(document).ready(function(){
  131.  
  132. $("#category").change(function(){
  133. var category = $("#category").val();
  134.  
  135. $.ajax({
  136. url : 'include/service.php',
  137. data : 'category='+category,
  138. type : 'POST',
  139. dataType: 'html',
  140. success : function(msg){
  141. $("#service").html(msg);
  142. }
  143. });
  144. });
  145.  
  146. $("#service").change(function(){
  147. var service = $("#service").val();
  148.  
  149. $.ajax({
  150. url : 'include/min.php',
  151. data : 'service='+service,
  152. type : 'POST',
  153. dataType: 'html',
  154. success : function(msg){
  155. $("#min").val(msg);
  156. }
  157. });
  158.  
  159. $.ajax({
  160. url : 'include/max.php',
  161. data : 'service='+service,
  162. type : 'POST',
  163. dataType: 'html',
  164. success : function(msg){
  165. $("#max").val(msg);
  166. }
  167. });
  168.  
  169. $.ajax({
  170. url : 'include/rate.php',
  171. data : 'service='+service,
  172. type : 'POST',
  173. dataType: 'html',
  174. success : function(msg){
  175. $("#rate").val(msg);
  176. }
  177. });
  178.  
  179. $.ajax({
  180. url : 'include/price.php',
  181. data : 'service='+service,
  182. type : 'POST',
  183. dataType: 'html',
  184. success : function(msg){
  185. $("#price").val(msg);
  186. }
  187. });
  188. });
  189.  
  190. });
  191. </script>
  192. <div class="card-body card-padding">
  193. <!-- start content -->
  194. <form class="form-horizontal" method="POST">
  195. <div class="form-group">
  196. <label class="col-md-12">Category</label>
  197. <div class="col-md-12">
  198. <select class="form-control" name="category" id="category">
  199. <option value="0">Pilih salah satu</option>
  200. <option value="IGF">Instagram Followers</option>
  201. <option value="IGL">Instagram Likes</option>
  202. <option value="IGV">Instagram Views</option>
  203. <option value="TW">Twitter</option>
  204. <option value="FB">Facebook</option>
  205. <option value="YT">Youtube</option>
  206. <option value="GP">Google Plus</option>
  207. <option value="VINE">Vine</option>
  208. <option value="SC">Soundcloud</option>
  209. <option value="WEB">Website</option>
  210. </select>
  211. </div>
  212. </div>
  213. <div class="form-group">
  214. <label class="col-md-12">Service</label>
  215. <div class="col-md-12">
  216. <select class="form-control" name="service" id="service">
  217. <option value="0">Pilih salah satu</option>
  218. </select>
  219. </div>
  220. </div>
  221.  
  222. <div class="alert alert-icon alert-info alert-dismissible fade in" role="alert">
  223. <button type="button" class="close" data-dismiss="alert" aria-label="Close">
  224. <span aria-hidden="true"><font color="red"><b>×</b></span></font>
  225. </button>
  226.  
  227.  
  228. <div class="form-group">
  229. <div class="col-md-4">
  230. <label>Price/1000</label>
  231. <div class="input-group"><span class="input-group-addon">Rp.</span>
  232. <input type="text" class="form-control" id="price" value="0" readonly>
  233. </div>
  234. </div>
  235. <div class="col-md-4">
  236. <label>Min</label>
  237. <div>
  238. <input type="text" class="form-control" id="min" value="0" readonly>
  239. </div>
  240. </div>
  241. <div class="col-md-4">
  242. <label>Max</label>
  243. <div>
  244. <input type="text" class="form-control" id="max" value="0" readonly>
  245. </div>
  246. </div>
  247. </div>
  248.  
  249. </div>
  250.  
  251. <div class="form-group">
  252. <div class="col-md-12">
  253. <label>Username/Link</label>
  254. <input type="text" class="form-control" name="link" placeholder="Username/Link" required>
  255. </div>
  256. </div>
  257. <div class="f
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement