<link href="images/index.css" rel="stylesheet" type="text/css">
<?
include "smscenter.db.php";
$KIRIM = $_POST[KIRIM];
$nomor = $_GET[nomor];
$pesan = $_GET[pesan];
if($KIRIM){

	$DestinationNumber=addslashes(strip_tags($_POST['DestinationNumber']));	
	$TextDecoded=addslashes(strip_tags($_POST['TextDecoded'])); 

	$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', ''
)
	";
	$query = "UPDATE inbox Set info = '1' where SenderNumber = '$nomor'";  
$result = mysql_query($query); 
$query = "UPDATE inbox Set balasan = '$TextDecoded' where SenderNumber = '$nomor'";  
$result = mysql_query($query); 

        mysql_query($sql); 

    

    echo "<b>SMS TELAH TERKIRIM</b>";
	exit;
}
?>

<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</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><BODY>
<fieldset>
<FORM name="catatanForm" method="post" enctype="multipart-form-data" onsubmit="return CheckForm(this)" action="">
<TABLE width="100%" border=0 cellpadding="6" cellspacing="6">

<TR bgcolor="#FF9900">
<TD colspan="3" class="headgbr"><table width="100%"  border="0" cellspacing="2" cellpadding="2">
  <tr>
    <td><span class="style1">BALAS PESAN </span></td>
  </tr>
</table></TD>
</TR>
<TR>
<TD width="18%">&nbsp;</TD>
<TD width="1%"></TD>
<TD width="81%">&nbsp;</TD>
</TR>
<TR>
  <TD>PESAN MASUK </TD>
  <TD></TD>
  <TD><?php echo $pesan; ?></TD>
</TR>

<TR>
  <TD>NOMOR TUJUAN </TD>
  <TD>:</TD>

  <TD> <input name="DestinationNumber" type="text" size=50 maxlength=14 value="<?php echo $nomor; ?>"> </TD>
</TR>

<TR>
  <TD>ISI PESAN ANDA </TD>
  <TD>:</TD>
  <TD><textarea name="TextDecoded" id="TextDecoded"  cols="70" rows="4" wrap="VIRTUAL"><?php echo @$TextDecoded; ?></textarea> <br><script>
displaylimit("","TextDecoded",140)
</script>  </TD>
</TR>

<TR>
  <TD>&nbsp;</TD>
  <TD>&nbsp;</TD>
  <TD>Pastikan Sistem SMS Telah Aktif sebelum membalas. Balaslah dengan kata-kata yang sopan singkat dan sesuai pertanyaan </TD>
</TR>
<TR>
  <TD>&nbsp;</TD>
  <TD>&nbsp;</TD>
  <TD><input type=Submit name="KIRIM" value="KIRIM PESAN SINGKAT"></TD>
</TR>
<TR>
  <TD>&nbsp;</TD>
  <TD>&nbsp;</TD>
  <TD>&nbsp;</TD>
</TR>
</TABLE>
<input type="hidden" name="modeofform" value="<?php echo $modeofform;?>">
<?php if(isset($UpdatedInDB))
echo "<input type='hidden' name='UpdatedInDB' value='$UpdatedInDB'>";

// outbox.form.php
?>
</FORM>
</fieldset>
</BODY>
</HTML>
