Advertisement
wisnu223

API.Php

Jun 26th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.96 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 = 88;
  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. echo json_encode($result);
  128. } else if (!$type) {
  129. $result = array(
  130. 'hasilnya' => 'error',
  131. 'alasan' => 'Data Masih Kosong'
  132. );
  133. echo json_encode($result);
  134. } else if (!$jumlah) {
  135. $result = array(
  136. 'hasilnya' => 'error',
  137. 'alasan' => 'Data Masih Kosong'
  138. );
  139. echo json_encode($result);
  140. } else if ($hasilnya['saldo'] < $hargatotal) {
  141. $result = array(
  142. 'hasilnya' => 'error',
  143. 'alasan' => 'Saldo kurang'
  144. );
  145. echo json_encode($result);
  146. } else {
  147. $postdata = 'api_key='.$key.'&link='.$link.'&jenis='.$type.'&jumlah='.$jumlah.'';
  148. $ch = curl_init();
  149. curl_setopt($ch, CURLOPT_URL, 'http://panelpedia.id/api.php');
  150. curl_setopt ($ch, CURLOPT_POST, 1);
  151. curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
  152. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  153. curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false);
  154. $store = curl_exec ($ch);
  155. curl_close ($ch);
  156. $json = json_decode($store,true);
  157. $id = $json['id'];
  158.  
  159. if ($json['result'] == "error") {
  160. $result = array(
  161. 'hasilnya' => 'error',
  162. 'alasan' => ''.$json['reason'].''
  163. );
  164. echo json_encode($result);;
  165. } else {
  166. $simpan = mysql_query("INSERT INTO historyall VALUES('', '$id', '$username', '$paket', '$hargatotal', 'Sukses', 'Url/Username : $link', '$tanggal')");
  167. $simpan = mysql_query("UPDATE user SET saldo=saldo-$hargatotal WHERE api_key = '$api_key'");
  168. if ($simpan) {
  169. $result = array(
  170. 'hasilnya' => 'sukses',
  171. 'orderid' => ''.$id.''
  172. );
  173. echo json_encode($result);;
  174. } else {
  175. echo 'ERROR..
  176. ';
  177. }
  178. }
  179. }
  180. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement