diamondpedia

gateway tsel

Nov 20th, 2019
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.61 KB | None | 0 0
  1. <?php
  2. /*
  3. Script Topup Otomatis Via Pulsa TSEL
  4. Creator : Salman El Faris
  5.  */
  6. require_once "config.php";
  7. require_once "EnvayaSMS.php";
  8. require_once "../mainconfig.php";
  9.  
  10.  if($action->from == '858' AND preg_match("/Anda mendapatkan penambahan pulsa/i", $isi_pesan)) {
  11.          $pesan_isi = $action->message;
  12.          $insert_order = mysqli_query($db, "INSERT INTO pesan_tsel (isi, status, date) VALUES ('$pesan_isi', 'UNREAD', '$date')");
  13.          $check_history_topup = mysqli_query($db, "SELECT * FROM history_topup WHERE status = 'NO' AND provider = 'TSEL' AND date = '$date'");
  14.          if (mysqli_num_rows($check_history_topup) == 0) {
  15.                 error_log("History TopUp Not Found $pesan_isi.|$date");
  16.          } else {
  17.              while($data_history_topup = mysqli_fetch_assoc($check_history_topup)) {
  18.                         $id_history = $data_history_topup['id'];
  19.                         $no_pegirim = $data_history_topup['no_pengirim'];
  20.                         $username_user = $data_history_topup['username'];
  21.                         $amount = $data_history_topup['amount'];
  22.                         $date_transfer = $data_history_topup['date'];
  23.                         $date_type = $data_history_topup['type'];
  24.                         $jumlah_transfer = $data_history_topup['jumlah_transfer'];
  25.                         $kodeny = $data_history_topup['kode'];
  26.                         $cekpesan = preg_match("/Anda mendapatkan penambahan pulsa Rp $jumlah_transfer dari nomor $no_pegirim tgl $date_transfer/i", $isi_pesan);
  27.                         if($cekpesan == true) {
  28.                             if($date_type == 'WEB' || $date_type == 'API'){
  29.                             if($date_type == 'WEB') {
  30.     $check_user = mysqli_query($db, "SELECT * FROM users WHERE username = '$username_user'");
  31.     $data_user = mysqli_fetch_assoc($check_user);
  32.     $saldoskr = $amount+$data_user['balance'];
  33. $pesannya="CLOUD PANEL: Terimakasih telah melakukan deposit sebesar Rp ".number_format($amount,0,',','.').". Saldo kamu sekarang adalah Rp ".number_format($saldoskr,0,',','.')."";
  34. $nomerhp=$data_user['nohp'];
  35. $postdata = "api_key=$cfg_apikey&pesan=$pesannya&nomer=$nomerhp";
  36. $apibase= "https://serverh2h.web.id/sms_gateway";
  37.  
  38. $ch = curl_init();
  39. curl_setopt($ch, CURLOPT_URL, $apibase);
  40. curl_setopt($ch, CURLOPT_POST, 1);
  41. curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
  42. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  43. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  44. $chresult = curl_exec($ch);
  45. curl_close($ch);
  46. $json_result = json_decode($chresult, true);
  47.                             $update_history_topup = mysqli_query($db, "UPDATE history_topup SET status = 'YES' WHERE id = '$id_history'");
  48.                             $update_history_topup = mysqli_query($db, "UPDATE users SET balance = balance+$amount WHERE username = '$username_user'");
  49.                             $update_history_topup = mysqli_query($db, "UPDATE users SET balance_api = balance_api+$jumlah_transfer WHERE username = 'dhifoaksa'");
  50.                            
  51.             $update_history_topup = mysqli_query($db, "INSERT INTO balance_history (username, action, quantity, msg, date, time) VALUES ('$username_user', 'Add Balance', '$amount', ' Deposit TSEL. Saldo yang didapat sebesar $amount', '$date', '$time')");
  52.                            
  53.                             } else if($date_type == 'API') {
  54.                             $update_history_topup = mysqli_query($db, "UPDATE history_topup SET status = 'YES' WHERE id = '$id_history'");
  55.                             $update_history_topup = mysqli_query($db, "UPDATE users SET balance = balance+$jumlah_transfer WHERE username = '$username_user'");
  56.                              $update_user = mysqli_query($db, "INSERT INTO balance_history (username, action, quantity, catatan, date, time) VALUES ('$username_user', 'add balance', '$amount', 'Add Balance. Via Auto Deposit Telkomsel API', '$date', '$time')");
  57.                            
  58.                             }
  59.                             if($update_history_topup == TRUE) {
  60.                                 error_log("Saldo $username_user Telah Ditambahkan Sebesar $amount");
  61.                             } else {
  62.                                 error_log("System Error");
  63.                             }
  64.                             } else if($date_type == 'REG'){
  65.                                 $ganti_no=str_replace("628","08",$no_pegirim);
  66.                             $update_history_topup = mysqli_query($db, "UPDATE history_topup SET status = 'YES' WHERE id = '$id_history'");
  67.                             $update_history_topup = mysqli_query($db, "UPDATE voc_reg SET status = 'Active' WHERE kode='$kodeny'");
  68.                              
  69.     $data_user = mysqli_fetch_assoc($check_history_topup);
  70.  $pesannya="Naughty Media :Thank You For Register Naughty Media Your Invite Code is ".$data_history_topup['kode']."";
  71. $nomerhp=$ganti_no;
  72. $postdata = "api_key=iISc1DiMdgT13QNeW5Tg&pesan=$pesannya&nomer=$nomerhp";
  73. $apibase= "https://serverh2h.web.id/sms_gateway";
  74.  
  75. $ch = curl_init();
  76. curl_setopt($ch, CURLOPT_URL, $apibase);
  77. curl_setopt($ch, CURLOPT_POST, 1);
  78. curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
  79. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  80. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  81. $chresult = curl_exec($ch);
  82. curl_close($ch);
  83. $json_result = json_decode($chresult, true);
  84.                         } else {
  85.                             error_log("data Regis Pulsa Tidak Ada");
  86.                         }
  87.                         } else {
  88.                             error_log("data Transfer Pulsa Tidak Ada");
  89.                         }
  90.                 }
  91.          }
  92.      }
Advertisement
Add Comment
Please, Sign In to add comment