<LINK href="images/index.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
    function refreshAndClose() {
        window.opener.location.reload(true);
        window.close();
    }
</script>
<body onbeforeunload="refreshAndClose();">
<?PHP
include("../index.globalconfig.php");
$p_nama1 = $_POST["p_nama"];
$p_nip1 = $_POST["p_nip"];
$p_nrp1 = $_POST["p_nrp"];
$p_pangkat1 = $_POST["p_pangkat"];
$p_nohp1 = $_POST["p_nohp"];
$p_jenis1 = $_POST["p_jenis"];
$error = "";
if ($p_nama1 == ""){$error = "Nama harus diisi<BR>";}
if ($p_nip1 == ""){$error = "NIP Harus Diisi!.<BR>";}
if ($p_nrp1 == ""){$error = "NRP Harus Diisi!.<BR>";}
if ($p_pangkat1 == ""){$error = "Pangkat Harus Dipilih!.<BR>";}
if ($p_nohp1 == ""){$error = "Nomor HP wajib di isi!.<BR>";}
if ($p_jenis1 == ""){$error = "Definisi Jaksa/TU Harus Dipilih!.<BR>";}
include("../index.cma.db.php");
if ($error == ""){
$query = "INSERT INTO tab_personil (daftar_nama, daftar_nip, daftar_nrp, daftar_pangkat, daftar_nohp, daftar_jenis) VALUES ('$p_nama1','$p_nip1','$p_nrp1','$p_pangkat1','$p_nohp1','$p_jenis1')";
$result = mysql_query($query);

if ($p_nohp1 == "")  {echo "NO HP KOSONG";} 
elseif ($p_nohp1 !== "0") {


//SMS
$smstemplate = $smspegawaibaru;
$isipesan = "$p_nama1 $smspegawaibaru"; //mixing isi pesan
$DestinationNumber=addslashes(strip_tags($p_nohp1));	
$TextDecoded=addslashes(strip_tags($isipesan)); 
$sql="INSERT INTO outbox (`UpdatedInDB` ,`InsertIntoDB` ,`SendingDateTime` ,`Text` ,`DestinationNumber` ,`Coding` ,`UDH` ,`Class` ,`TextDecoded` ,`ID` ,`MultiPart` ,`RelativeValidity` ,`SenderID` ,`SendingTimeOut` ,`DeliveryReport` ,`CreatorID`)
VALUES (NOW() , NOW(), '0000-00-00 00:00:00', NULL , '$DestinationNumber', 'Default_No_Compression', NULL , '-1', '$TextDecoded', NULL , 'false', '-1', NULL , '0000-00-00 00:00:00', 'default', '')";
mysql_query($sql); 
} 
print ('<table width="50%"  border="0" align="center" cellpadding="6" cellspacing="6">
  <tr>
    <td>BERHASIL DISIMPAN TUTUP JENDELA INI</td>
  </tr>
</table>');
}
else
{
echo "$error.";
} 
?>
