Tuesday, February 18, 2020

PHP Script Bot Otomatis WAGW

PHP Script Bot Otomatis WAGW

Contoh script bot otomatis WAGW menggunakan PHP

<?php 
ini_set('default_charset', 'UTF-8');
require_once('../include/database.config.php');
require_once('../keuangan/include/rupiah.php');

$method = $_SERVER['REQUEST_METHOD'];

if($method == 'GET'){
 $idinbox = $_REQUEST['idinbox']; 
 $from = $_REQUEST['from'];
 $tanggal = $_REQUEST['tanggal'];
 $pengirim = $_REQUEST['pengirim'];
 $pengirim =  str_replace('pkiqf','+',$pengirim);
 $pesan = utf8_encode($_REQUEST['pesan']);
 
 $pesan_arr = preg_split ("/\=/", $pesan); 

 $gpesan = "select * from jbssms.inbox where TGLJAM='".$tanggal."' and SenderNumber='".$pengirim."' and Text='".$pesan."' and status=0 limit 1";
 $hasilpesan = mysql_query($gpesan);
 if (mysql_num_rows($hasilpesan) > 0){
  while($rowpesan = mysql_fetch_array($hasilpesan)) {
   if ($pesan == "KT") { 
    $hasil = "[x*x]🤖 TPC - Informasi 🤖[x*x][xbx][xbx]ndang mulih.";   
   } else {
    $hasil = "[x*x]🤖 TPC - Informasi 🤖[x*x][xbx][xbx]Maaf, perintah Anda [[ [x*x]". $pesan ."[x*x] ]] tidak dikenali oleh sistem kami.";
   }
   
   if ($from == "whatsapp") {
    $sql = "INSERT INTO jbssms.outbox (Text,DestinationNumber,kirimwhatsapp,kirimtelegram, TextDecoded) values ('" . $hasil . "', N'" . $pengirim . "', 0, 1, 'bot');";
   } 
   
   if ($from == "telegram") {
    $sql = "INSERT INTO jbssms.outbox (Text,DestinationNumber,kirimwhatsapp,kirimtelegram, TextDecoded) values ('" . $hasil . "', N'" . $pengirim . "', 1, 0, 'bot');";
   }
   
   mysql_query($sql);
   
   $updateQ = "UPDATE jbssms.inbox SET status=1 WHERE TGLJAM='".$tanggal."' and SenderNumber='".$pengirim."' and Text='".$pesan."'";
   
   mysql_query($updateQ);
   
   ob_start();
   echo "Perintah : ".$sql."\r\n";
   echo "updateQ : ".$updateQ."\r\n";
   echo "Dikirim dari : ".$from."\r\n";
   echo "Tanggal : ".$tanggal."\r\n";
   echo "Pengirim : ".$pengirim."\r\n";
   echo "Isi pesan : ".$pesan;
   $htmlStr = ob_get_contents();
   ob_end_clean(); 
   if ($from == "whatsapp") {
    file_put_contents("hasilbotw.txt", $htmlStr); 
   }
   if ($from == "telegram") {
    file_put_contents("hasilbott.txt", $htmlStr); 
   }     
  }
 }  
}
else
{
 echo "Kamu siapa?";
}

?>

Post a Comment