Advertisement
wisnu223

api.php

Jun 27th, 2016
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. <?php
  2. // script API By Yoga Wahyu Firmansyah
  3.  
  4. include_once "koneksi.php";
  5. $api_key = $_POST['api_key']; // kode API pembeli / yang submit
  6.  
  7. $query = mysql_query("SELECT * FROM user WHERE api_key = '$api_key'");
  8. $jumlah = mysql_num_rows($query);
  9. $hasilnya = mysql_fetch_array($query);
  10. $username = $hasilnya['username']; // username pembeli
  11.  
  12.  
  13. $key = "4xp6rg9riypd012f5qd0s5ef9d15j9ed"; // kode api panelpedia
  14. $link = $_POST['link']; // username waktu proses
  15. $type = $_POST['type']; // jenis packet
  16. $jumlah = $_POST['jumlah']; // Jumlah yang di submit
  17. $tanggal = date("Y-m-d"); // tanggal
  18.  
  19.  
  20. if ($type == 1) { // kode layanan di panel pedia harus sama
  21. $harga = 16; // harga paket nya
  22. $paket = "Instagram Followers Very Fast WP Server 1"; // keterangan paket
  23. } else if ($type == 69) {
  24. $harga = 85;
  25. $paket = "Instagram Followers Aktif Indonesia";
  26. } else if ($type == 2) {
  27. $harga = 15;
  28. $paket = "Instagram Followers USA HQ Slow Server 2";
  29. } else if ($type == 3) {
  30. $harga = 19;
  31. $paket = "Instagram Followers Fast Big Server 3";
  32. } else if ($type == 4) {
  33. $harga = 15;
  34. $paket = "Instagram Followers HQ Slow Server 4";
  35. } else if ($type == 5) {
  36. $harga = 11;
  37. $paket = "Instagram Likes Very Fast Server 1";
  38. } else if ($type == 20) {
  39. $harga = 12;
  40. $paket = "Instagram Likes Very Fast Server 2";
  41. } else if ($type == 30) {
  42. $harga = 15;
  43. $paket = "Instagram Video Views Fast Server 1";
  44. } else if ($type == 31) {
  45. $harga = 16;
  46. $paket = "Instagram Video Views Server 2";
  47. } else if ($type == 6) {
  48. $harga = 20;
  49. $paket = "Twitter Followers Instant (Kirim username saja)";
  50. } else if ($type == 7) {
  51. $harga = 19;
  52. $paket = "Twitter Retweets Instant | Max 10000";
  53. } else if ($type == 8) {
  54. $harga = 19;
  55. $paket = "Twitter Favorites Instant | Max 10000";
  56. } else if ($type == 9) {
  57. $harga = 10;
  58. $paket = "Youtube Views Super Fast";
  59. } else if ($type == 21) {
  60. $harga = 190;
  61. $paket = "Youtube Video Likes";
  62. } else if ($type == 22) {
  63. $harga = 280;
  64. $paket = "Youtube Video Dislikes";
  65. } else if ($type == 23) {
  66. $harga = 100;
  67. $paket = "Youtube Video Reshare";
  68. } else if ($type == 18) {
  69. $harga = 15;
  70. $paket = "Facebook Video Views";
  71. } else if ($type == 17) {
  72. $harga = 10;
  73. $paket = "Soundcloud Downloads";
  74. } else if ($type == 27) {
  75. $harga = 130;
  76. $paket = "Soundcloud Followers";
  77. } else if ($type == 10) {
  78. $harga = 90;
  79. $paket = "Facebook Fanspage Likes Start 24jam";
  80. } else if ($type == 11) {
  81. $harga = 11;
  82. $paket = "Soundcloud Plays";
  83. } else if ($type == 12) {
  84. $harga = 15;
  85. $paket = "Facebook Photo/Post Likes Fast";
  86. } else if ($type == 13) {
  87. $harga = 16;
  88. $paket = "Vine Followers";
  89. } else if ($type == 14) {
  90. $harga = 16;
  91. $paket = "Vine Likes";
  92. } else if ($type == 15) {
  93. $harga = 16;
  94. $paket = "Vine Revines Super Fast | Max Order 200000";
  95. } else if ($type == 16) {
  96. $harga = 16;
  97. $paket = "Vine Loops";
  98. } else if ($type == 19) {
  99. $harga = 10;
  100. $paket = "Website Traffic Fast";
  101. } else if ($type == 29) {
  102. $harga = 750;
  103. $paket = "Snapchat Followers";
  104. } else {
  105. $type1 = "ERROR";
  106. }
  107.  
  108. $hargatotal = $jumlah * $harga; // jumlah ditotal $harga contoh 16 x 100 Jumlah = 1600 Saldo
  109.  
  110. if(mysql_num_rows($query) == 0) { // buat cek kode API web kamu
  111. $result = array(
  112. 'hasilnya' => 'error',
  113. 'alasan' => 'Kode API Salah'
  114. );
  115. echo json_encode($result);
  116. } else if ($jumlah < 100) {
  117. $result = array(
  118. 'hasilnya' => 'error',
  119. 'alasan' => 'Min Order 100'
  120. );
  121. echo json_encode($result);
  122. } else if (!$link) {
  123. $result = array(
  124. 'hasilnya' => 'error',
  125. 'alasan' => 'Data Masih Kosong'
  126. );
  127.  
  128. echo json_encode($result);
  129. } else if (!$jumlah) {
  130. $result = array(
  131. 'hasilnya' => 'error',
  132. 'alasan' => 'Data Masih Kosong'
  133. );
  134. echo json_encode($result);
  135. } else if ($hasilnya['saldo'] < $hargatotal) {
  136. $result = array(
  137. 'hasilnya' => 'error',
  138. 'alasan' => 'Saldo kurang'
  139. );
  140. echo json_encode($result);
  141. } else {
  142. $postdata = 'api_key='.$key.'&link='.$link.'&type='.$type.'&jumlah='.$jumlah.'';
  143. $ch = curl_init();
  144. curl_setopt($ch, CURLOPT_URL, 'http://panelpedia.id/api.php');
  145. curl_setopt ($ch, CURLOPT_POST, 1);
  146. curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
  147. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  148. curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
  149. $store = curl_exec ($ch);
  150. curl_close ($ch);
  151. $json = json_decode($store,true);
  152. $id = $json['id'];
  153.  
  154. if ($json['result'] == "error") {
  155. $result = array(
  156. 'hasilnya' => 'error',
  157. 'alasan' => ''.$json['reason'].''
  158. );
  159. echo json_encode($result);;
  160. } else {
  161. $simpan = mysql_query("INSERT INTO historyall VALUES('', '$id', '$username', '$paket', '$hargatotal', 'Sukses', 'Url/Username : $link', '$tanggal')");
  162. $simpan = mysql_query("UPDATE user SET saldo=saldo-$hargatotal WHERE api_key = '$api_key'");
  163. if ($simpan) {
  164. $result = array(
  165. 'hasilnya' => 'sukses',
  166. 'orderid' => ''.$id.''
  167. );
  168. echo json_encode($result);;
  169. } else {
  170. echo 'ERROR..
  171. ';
  172. }
  173. }
  174. }
  175. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement