<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
<table width="100%"  border="0" cellspacing="5" cellpadding="5">
  <tr>
    <td width="73%" valign="top"><?php
include "smscenter.db.php";
mysql_connect($site["dbhost"], $site["dblogin"], $site["dbpass"]);
mysql_select_db($site["dbname"]);
?>
        <style type="text/css">
<!--
.style1 {	color: #FFFFFF;
	font-weight: bold;
}
-->
  </style>
        <link href="images/index.css" rel="stylesheet" type="text/css">
        <style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
}
-->
  </style>
        <script type="text/javascript">

/*
Form field Limiter script- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}


function displaylimit(thename, theid, thelimit){
var theform=theid!=""? document.getElementById(theid) : thename
var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b> Batasan karakter'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}

  </script>
        <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
          <table width="100%"  border="0" cellspacing="2" cellpadding="2">
            <tr>
              <td bgcolor="#996633"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
                  <tr>
                    <td><span class="style1"><strong>PENGIRIMAN PESAN GRUP</strong></span></td>
                  </tr>
              </table></td>
            </tr>
          </table>
          <table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td>Pesan singkat hanya terkirim kepada pegawai atau jaksa yang terdapat nomor HP. pastikan kelengkapan kepegawaian disertai nomor kepegawaian untuk notifikasi Pembinaan maupun Waskat</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>
          <table width="100%"  border="0" cellspacing="6" cellpadding="6">
            <tr>
              <td width="22%"><div align="right"><b>Pilih Grup Penerima</b></div></td>
              <td width="2%">:</td>
              <td width="76%">
			  <select name="grup" id="grup" onChange="this.form.submit()">
              <option value="1">Jaksa</option>
              <option value="2">Pembinaan</option>
              <option value="3">Intel</option>
              <option value="4">Pidum</option>
              <option value="5">Pidsus</option>
              <option value="6">Datun</option>
			  <option value="9">Semua</option>
              <option value="0" selected>---Pilih---</option>
          </select>
			  </td>
            </tr>
            <tr>
              <td><div align="right"><b>Masukkan isi SMS</b></div></td>
              <td>:</td>
              <td><textarea name="sms" id="sms" cols="70" rows="7" wrap="VIRTUAL"></textarea>
                  <br>
                  <script>
displaylimit("","sms",160)
    </script>
              </td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td>(maksimum panjang SMS adalah 160 karakter) </td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td>&nbsp;</td>
              <td><input type="submit" name="submit" value="Kirim SMS"></td>
            </tr>
          </table>
        </form>
        <table width="100%"  border="0" cellspacing="6" cellpadding="6">
          <tr>
            <td colspan="3"><strong>SMS DIKIRIMKAN KEDAFTAR NAMA: </strong></td>
          </tr>
          <tr>
            <td width="22%">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td width="76%">

<?php
if ($_POST['submit'])
{
//-------KATEGORI
$sms = $_POST['sms'];
$grup = $_POST['grup'];
include("../index.cma.db.php");
if ($grup == "1"){
echo "<b>SMS SUDAH DIKIRIM KE NAMA DAFTAR JAKSA:</b><br>";
$sql2=mysql_query("select * from tab_personil where daftar_jenis = '1' && daftar_nohp !='0'");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smscenter.db.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}}
//-------KATEGORI
if ($grup == "2"){
echo "<b>SMS SUDAH DIKIRIM KE NAMA DAFTAR PEGAWAI PEMBINAAN:</b> <br>";
$sql2=mysql_query("select * from tab_personil where daftar_jenis = '2' && daftar_nohp !='0'");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smscenter.db.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}}
//-------KATEGORI
if ($grup == "3"){

echo "<b>SMS SUDAH DIKIRIM KE NAMA DAFTAR PEGAWAI INTEL: </b><br>";
$sql2=mysql_query("select * from tab_personil where daftar_jenis = '3' && daftar_nohp !='0'");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smscenter.db.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}}
if ($grup == "4"){

echo "<b>SMS SUDAH DIKIRIM KE NAMA DAFTAR PEGAWAI PIDUM:</b><br>";
$sql2=mysql_query("select * from tab_personil where daftar_jenis = '4' && daftar_nohp !='0'");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smscenter.db.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}}
if ($grup == "5"){

echo "<b>SMS SUDAH DIKIRIM KE NAMA DAFTAR PEGAWAI PIDSUS: </b><br>";
$sql2=mysql_query("select * from tab_personil where daftar_jenis = '5' && daftar_nohp !='0'");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smscenter.db.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}}
///END KATEGORI
if ($grup == "6"){

echo "<b>SMS SUDAH DIKIRIM KE NAMA DAFTAR PEGAWAI DATUN: </b><br>";
$sql2=mysql_query("select * from tab_personil where daftar_jenis = '6' && daftar_nohp !='0'");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smscenter.db.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}}

//-kIRIM SMS KESEMUA
if ($grup == "9"){

$sql2=mysql_query("select * from tab_personil where daftar_nohp !='0'");
while ($row=mysql_fetch_array($sql2))
{
$nohp = $row['daftar_nohp'];
$name = $row['daftar_nama'];
echo "" .$name. " NO : " .$nohp. "<br>";
include "smscenter.db.php";
$query3 = "INSERT INTO outbox (DestinationNumber, TextDecoded, CreatorID, class) VALUES ('$nohp', '$sms', 'Gammu', '-1')";
mysql_query($query3);
}}


?>
</td>
          </tr>
      </table></td>
  </tr>
</table>
<? } ?>