<html>
<head>
<meta http-equiv="refresh" content="60; url=<?php $_SERVER['PHP_SELF']; ?>">
</head>
<body>
<h1>SMS SERVER SEDANG BERJALAN (AUTO REFRESH DALAM 60 DETIK)....</h1>
<?php
mysql_connect("localhost", "root", "benk");
mysql_select_db("smsd");
$query = "SELECT * FROM inbox WHERE Processed = 'false'";
$hasil = mysql_query($query);
while ($data = mysql_fetch_array($hasil))
{
  $id = $data['ID'];
  $noPengirim = $data['SenderNumber'];
if ($noPengirim == "+6281578189800"){
  $msg = strtoupper($data['TextDecoded']);
$pecah = explode("#", $msg, 3);
  if ($pecah[0] == "FWD")
  {
     $nim = $pecah[1];
	  $sms2 = $pecah[2];
	  $sms = ''.$sms2.'-D';
	 print (''.$nim.'');
 mysql_connect("localhost", "root", "benk");
mysql_select_db("smsd");
$id = $data['ID'];
 $query3 = "UPDATE inbox SET Processed = 'true' WHERE ID = '$id'";
  $hasil3 = mysql_query($query3);
  include("index_.db.php");
if ($nim == "JAKSA"){
echo "<b>SMS DIKIRIM KE NAMA DAFTAR JAKSA:</b><br>";
$sql2=mysql_query("select * from slm_daftarjaksa where daftar_status = '0'");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);

}
$danar = "081578189800";
$query4 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$danar', '$sms', 'Gammu', '-1')";
mysql_query($query4);
}

//-------KATEGORI
if ($nim == "BIN"){
echo "<b>SMS DIKIRIM KE NAMA DAFTAR PEGAWAI PEMBINAAN:</b> <br>";
include("index_.db.php");
$sql2=mysql_query("select * from slm_daftarbin");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);

}
$danar = "081578189800";
$query4 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$danar', '$sms', 'Gammu', '-1')";
mysql_query($query4);
}

//-------KATEGORI
if ($nim == "INTEL"){
include("index_.db.php");
echo "<b>SMS DIKIRIM KE NAMA DAFTAR PEGAWAI INTEL: </b><br>";
$sql2=mysql_query("select * from slm_daftarintel");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}
$danar = "081578189800";
$query4 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$danar', '$sms', 'Gammu', '-1')";
mysql_query($query4);
}
if ($nim == "pidum"){
include("index_.db.php");
echo "<b>SMS DIKIRIM KE NAMA DAFTAR PEGAWAI PIDUM:</b><br>";
$sql2=mysql_query("select * from slm_daftarpidum");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}
$danar = "081578189800";
$query4 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$danar', '$sms', 'Gammu', '-1')";
mysql_query($query4);
}
if ($nim == "PIDSUS"){
include("index_.db.php");
echo "<b>SMS DIKIRIM KE NAMA DAFTAR PEGAWAI PIDSUS: </b><br>";
$sql2=mysql_query("select * from slm_daftarpidsus");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);}}
///END KATEGORI
if ($nim == "DATUN"){
include("index_.db.php");
echo "<b>SMS DIKIRIM KE NAMA DAFTAR PEGAWAI DATUN: </b><br>";
$sql2=mysql_query("select * from slm_daftardatun");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}
$danar = "081578189800";
$query4 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$danar', '$sms', 'Gammu', '-1')";
mysql_query($query4);
}
///END KATEGORI
///END KATEGORI
if ($nim == "LAIN"){
include("index_.db.php");
echo "<b>SMS DIKIRIM KE NAMA DAFTAR LAIN: </b><br>";
$sql2=mysql_query("select * from slm_daftarlain");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}
$danar = "081578189800";
$query4 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$danar', '$sms', 'Gammu', '-1')";
mysql_query($query4);
}
///END KATEGORI
//-kIRIM SMS KESEMUA
if ($nim == "ALL"){
include("index_.db.php");
echo "<hr><b>SMS DIKIRIM KE DAFTAR JAKSA:</b> <br>";
$sql2=mysql_query("select * from slm_daftarjaksa where daftar_status = '0'");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}
include("index_.db.php");
echo "<hr><b>SMS DIKIRIM KE DAFTAR NAMA PEGAWAI PEMBINAAN:</b><br>";
$sql2=mysql_query("select * from slm_daftarbin");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}
include("index_.db.php");
echo "<hr><b>SMS DIKIRIM KE DAFTAR NAMA PEGAWAI INTELIJEN:</b><br>";
$sql2=mysql_query("select * from slm_daftarintel");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}
include("index_.db.php");
echo "<hr><b>SMS DIKIRIM KE DAFTAR NAMA PEGAWAI PIDANA UMUM:</b><br>";
$sql2=mysql_query("select * from slm_daftarpidum");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', -1)";
mysql_query($query3);
}
include("index_.db.php");
echo "<hr><b>SMS DIKIRIM KE DAFTAR NAMA PEGAWAI PIDANA KHUSUS:</b><br>";
$sql2=mysql_query("select * from slm_daftarpidsus");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', -1)";
mysql_query($query3);
}
include("index_.db.php");
echo "<hr><b>SMS DIKIRIM KE DAFTAR NAMA PEGAWAI DATUN:</b><br>";
$sql2=mysql_query("select * from slm_daftardatun");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', -1)";
mysql_query($query3);
}
///END KATEGORI
include("index_.db.php");
echo "<hr><b>SMS DIKIRIM KE DAFTAR LAIN:</b><br>";
$sql2=mysql_query("select * from slm_daftarlain");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smsdb.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', -1)";
mysql_query($query3);
}
///END KATEGORI

echo "<hr><b>SMS TELAH TERKIRIM KE SEMUA PEGAWAI DAN JAKSA. ANDA TELAH MENGGUNAKAN SMS CENTER KN. SLEMAN</b>";


}}}

else 
 mysql_connect("localhost", "root", "benk");
mysql_select_db("smsd");
$id = $data['ID'];
 $query3 = "UPDATE inbox SET Processed = 'true' WHERE ID = '$id'";
  $hasil3 = mysql_query($query3);
print ('ilegal akses');
}

?>
