Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "smsGateway.php";
- require "../../mainconfig.php";
- $smsGateway = new SmsGateway('shandiap26@gmail.com', 'wawah123');
- $deviceID = 1234567; // Check di Website http://smsgateway.me
- $page = 1;
- $action = $smsGateway->getMessages($page);
- foreach ($action['response']['result'] as $result) {
- if($result['status'] == 'received' && $result['contact']['number'] == "168" && preg_match('/Anda menerima Pulsa/i', $result['message'])){
- $message = $result['message'];
- $timestamp = $result['created_at'];
- if($result['contact']['number'] == "168" AND preg_match("/Anda menerima Pulsa/i", $message)){
- $insert_order = mysqli_query($db, "INSERT INTO pesan_tsel (isi, status, date) VALUES ('$message', 'UNREAD', '$date')");
- $check_deposit = mysqli_query($db, "SELECT * FROM deposits_history WHERE status = 'Waiting' AND method = 'XL' AND date = '$date'");
- if (mysqli_num_rows($check_deposit) == 0) {
- error_log("History TopUp Not Found<br />.");
- echo "History TopUp Not Found<br/>.";
- } else {
- while($data_deposit = mysqli_fetch_assoc($check_deposit)) {
- $id_deposit = $data_deposit['id'];
- $no_sender = $data_deposit['no_sender'];
- $user = $data_deposit['user'];
- $amount_deposit = $data_deposit['quantity'];
- $date_transfer = $data_deposit['date'];
- $deposit_type = $data_deposit['type'];
- $amount_transfer = $data_deposit['get_balance'];
- $check_message = preg_match("/Anda menerima Pulsa dari $no_sender sebesar Rp$amount_deposit/i", $message);
- if($check_message == TRUE) {
- if($deposit_type == 'WEB') {
- $update_history_topup = mysqli_query($db, "UPDATE deposits_history SET status = 'Success' WHERE id = '$id_deposit'");
- $update_history_topup = mysqli_query($db, "UPDATE users SET balance = balance+$amount_deposit WHERE username = '$user'");
- }
- if($update_history_topup == TRUE) {
- error_log("Saldo $user Telah Ditambahkan Sebesar $amount_deposit");
- echo "Saldo $user Telah Ditambahkan Sebesar $amount_deposit";
- echo "<br />";
- $send_result = $smsGateway->sendMessageToNumber($no_sender, "Terimakasih, Anda telah berhasil melakukan deposit saldo otomatis $cfg_webname dengan jumlah $amount_deposit.", $deviceID);
- if ($send_result == TRUE) {
- 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.");
- } else {
- error_log("Gagal mengirimkan pesan kepada nomor: $no_sender");
- }
- } else {
- error_log("System Error");
- echo "System Error";
- }
- } else {
- error_log("data Transfer Pulsa Tidak Ada");
- echo "data Transfer Pulsa Tidak Ada";
- }
- }
- }
- } else {
- error_log("Hasil pencarian sms penambahan pulsa tidak ditemukan dari pusat.");
- echo "Hasil pencarian sms penambahan pulsa tidak ditemukan dari pusat.";
- echo "<br />";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement