Advertisement
dganisha

SALDO

Sep 19th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.81 KB | None | 0 0
  1. <?php
  2.  
  3. require_once("konak.php");
  4.  
  5.                            
  6.                     $url = 'http://smsgateway.me/api/v3/messages/view/44119311';                
  7.                     $data = array(
  8.                     'URL' => 'http://smsgateway.me/api/v3/messages/view/44079884',
  9.                     'Method' => 'GET',
  10.                     'email' => '',
  11.                     'password' => '',
  12.  
  13.  
  14.                     );
  15.  
  16.                     $ch = curl_init();
  17.                     curl_setopt($ch, CURLOPT_URL, $url);
  18.                     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  19.                     curl_setopt($ch, CURLOPT_POST, 1);
  20.                     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  21.                     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  22.                     $result = curl_exec($ch);
  23.  
  24.                     //echo $result;
  25.                     $data = json_decode($result);
  26.                     $hasil = $data->result->message;
  27.                     //echo $hasil;
  28.                    
  29.                         $pisah_1 = explode('pulsa ',$hasil);
  30.                         $pisah_2 = explode('.',$pisah_1[1]);
  31.                         $hasil2 = $pisah_2[0];
  32.                         $hasil3 = $hasil2;
  33.                         echo $hasil3;
  34.                        
  35.                         $send = mysql_query("UPDATE request_balance SET status = 'Success' WHERE quantity = '$hasil2' AND status != 'Success'");
  36.                         //Cek username
  37.                         $queri = mysql_query("SELECT * FROM request_balance WHERE quantity = '$hasil2'");
  38.                                 $get = mysql_fetch_array($queri);
  39.                                 $usernya = $get['username'];
  40.                                 $sts = $get['status'];
  41.                         //Mengupdate balance
  42.                         if ($send && mysql_affected_rows() > 0){
  43.                             $kirim = mysql_query("UPDATE user SET balance=balance+$hasil2 WHERE username = '$usernya'");
  44.                             echo "berhasil";
  45.                         }else{
  46.                             $kirim = mysql_query("UPDATE user SET balance=balance+0 WHERE username = '$usernya'");
  47.                             echo "Gagal";
  48.                         }
  49.  
  50.  
  51.                     ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement