Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. <?php
  2. include "smsGateway.php";
  3. require "../../mainconfig.php";
  4. $smsGateway = new SmsGateway('shandiap26@gmail.com', 'wawah123');
  5. $deviceID = 1234567; // Check di Website http://smsgateway.me
  6. $page = 1;
  7.  
  8. $action = $smsGateway->getMessages($page);
  9. foreach ($action['response']['result'] as $result) {
  10. if($result['status'] == 'received' && $result['contact']['number'] == "168" && preg_match('/Anda menerima Pulsa/i', $result['message'])){
  11.  
  12. $message = $result['message'];
  13. $timestamp = $result['created_at'];
  14.  
  15. if($result['contact']['number'] == "168" AND preg_match("/Anda menerima Pulsa/i", $message)){
  16. $insert_order = mysqli_query($db, "INSERT INTO pesan_tsel (isi, status, date) VALUES ('$message', 'UNREAD', '$date')");
  17. $check_deposit = mysqli_query($db, "SELECT * FROM deposits_history WHERE status = 'Waiting' AND method = 'XL' AND date = '$date'");
  18. if (mysqli_num_rows($check_deposit) == 0) {
  19. error_log("History TopUp Not Found<br />.");
  20. echo "History TopUp Not Found<br/>.";
  21. } else {
  22. while($data_deposit = mysqli_fetch_assoc($check_deposit)) {
  23. $id_deposit = $data_deposit['id'];
  24. $no_sender = $data_deposit['no_sender'];
  25. $user = $data_deposit['user'];
  26. $amount_deposit = $data_deposit['quantity'];
  27. $date_transfer = $data_deposit['date'];
  28. $deposit_type = $data_deposit['type'];
  29. $amount_transfer = $data_deposit['get_balance'];
  30. $check_message = preg_match("/Anda menerima Pulsa dari $no_sender sebesar Rp$amount_deposit/i", $message);
  31. if($check_message == TRUE) {
  32.  
  33. if($deposit_type == 'WEB') {
  34. $update_history_topup = mysqli_query($db, "UPDATE deposits_history SET status = 'Success' WHERE id = '$id_deposit'");
  35. $update_history_topup = mysqli_query($db, "UPDATE users SET balance = balance+$amount_deposit WHERE username = '$user'");
  36. }
  37. if($update_history_topup == TRUE) {
  38. error_log("Saldo $user Telah Ditambahkan Sebesar $amount_deposit");
  39. echo "Saldo $user Telah Ditambahkan Sebesar $amount_deposit";
  40. echo "<br />";
  41. $send_result = $smsGateway->sendMessageToNumber($no_sender, "Terimakasih, Anda telah berhasil melakukan deposit saldo otomatis $cfg_webname dengan jumlah $amount_deposit.", $deviceID);
  42. if ($send_result == TRUE) {
  43. error_log("Berhasil mengirimkan pesan kepada nomor: $no_sender dengan pesan: Terimakasih, Anda telah berhasil melakukan deposit saldo otomatis $cfg_webname dengan jumlah $amount_deposit.");
  44. } else {
  45. error_log("Gagal mengirimkan pesan kepada nomor: $no_sender");
  46. }
  47. } else {
  48. error_log("System Error");
  49. echo "System Error";
  50. }
  51. } else {
  52. error_log("data Transfer Pulsa Tidak Ada");
  53. echo "data Transfer Pulsa Tidak Ada";
  54. }
  55. }
  56. }
  57. } else {
  58. error_log("Hasil pencarian sms penambahan pulsa tidak ditemukan dari pusat.");
  59. echo "Hasil pencarian sms penambahan pulsa tidak ditemukan dari pusat.";
  60. echo "<br />";
  61. }
  62. }
  63. }
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement