<div id="_quick_sms" style="position: absolute;left: 393px; top: 64px; display:none;">
<form id="form_quick_sms" name="form_quick_sms" action="">
<table border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF" id="t_quick_sms" style="border:thin solid #999999;">
<tr>
<td colspan="3" bgcolor="#CCCCCC"><strong>Quick SMS Vonix v.01.02 </strong></td>
</tr>
<tr>
<td valign="top"><strong>Mid</strong></td>
<td valign="top"><strong>:</strong></td>
<td><input name="mid" type="text" id="mid" readonly="true"/></td>
</tr>
<tr>
<td valign="top"><strong>Nama</strong></td>
<td valign="top"><strong>:</strong></td>
<td><input name="nama" type="text" id="nama" readonly="true"/></td>
</tr>
<tr>
<td valign="top"><strong>Nohp</strong></td>
<td valign="top"><strong>:</strong></td>
<td><input name="nohp" type="text" id="nohp" /></td>
</tr>
<tr>
<td valign="top"><strong>Pesan</strong></td>
<td valign="top"><strong>:</strong></td>
<td><textarea name="mess" id="mess"></textarea>
<br />
<input name="charlength" type="text" id="charlength" value="0" size="1" readonly="true"/>
<input name="countsms" type="text" id="countsms" value="0" size="1" readonly="true"/>
<input name="clear" type="button" id="clear" value="Clear" /></td>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
<td><input name="kirim" type="button" id="kirim" value="Kirim" />
<input name="cancel" type="button" id="cancel" value="Cancel" /></td>
</tr>
</table>
</form>
</div>
<script language="javascript">
quick_sms={
show:function(){$("#_quick_sms").show();},
hide:function(){$("#_quick_sms").hide();},
make:function(mid,nama,nohp){
this.show();
$("#form_quick_sms #mid").val(mid);
$("#form_quick_sms #nama").val(nama);
$("#form_quick_sms #nohp").val(nohp);
this.clearmess();
},
kirim:function(){
nohp=this.validhp();
mess=this.validmess();
if(this.getcharlength()>0){
/*metode for smscc2*/
//$.post("../process.php",{act:"smsout",idin:"0",nohp:nohp,mess:mess},function(msg){alert("Data Saved: "+msg);});
/*metode for other app*/
$.post("module/quick_sms/relay_quick_sms.php",{act:"smsout",idin:"0",nohp:nohp,mess:mess},function(msg){alert("Data Saved: "+msg);});
}else{
alert("data yang dikirim belum memadai");
}
},
replacinghp:function(nohp,f,r){
l=nohp.length;
lf=f.length;
out=r+nohp.substring(lf,l);
//alert(out);
return out;
},
validhp:function(){
nohp = $("#form_quick_sms #nohp").val();
if(nohp.substring(0,2)=="08"){
//alert(1);
return quick_sms.replacinghp(nohp,"08","08");
}else if(nohp.substring(0,2)=="02"){
//alert(2);
return quick_sms.replacinghp(nohp,"02","02");
}else if(nohp.substring(0,2)=="62"){
//alert(3);
return quick_sms.replacinghp(nohp,"62","0");
}else if(nohp.substring(0,3)=="+62"){
//alert(4);
return quick_sms.replacinghp(nohp,"+62","0");
}
},
validmess:function(){
return this.getmess();
},
updateview:function(){
$("#form_quick_sms #charlength").val(this.getcharlength());
$("#form_quick_sms #countsms").val(this.getcountsms());
},
getcharlength:function(){return this.getmess().length;},
getcountsms:function(){
l=this.getcharlength();
if(l<=0){
return 0;
}else if((l>0)&&(l<=160)){
return 1;
}else if((l>160)&&(l<=320)){
return 2;
}else if(l>320){
alert("melebihi batas maksimum character");
/*cut maximum*/
this.setmess(this.getmess().substring(0,320));
this.updateview();
return 2;
}
},
getmess:function(){return $("#form_quick_sms #mess").val();},
setmess:function(val){$("#form_quick_sms #mess").val(val);},
clearmess:function(){quick_sms.setmess(""); quick_sms.updateview();}
}
$("#form_quick_sms #kirim").click(
function(){
quick_sms.kirim();
}
);
$("#form_quick_sms #mess").keyup(
function(event){
if(event.keyCode==13){
quick_sms.setmess(quick_sms.getmess().substring(0,quick_sms.getcharlength()-1));
}
quick_sms.updateview();
}
);
$("#form_quick_sms #clear").click(function(){quick_sms.clearmess();});
$("#form_quick_sms #cancel").click(function(){quick_sms.hide();});
</script>
<input type="button" name="Button" value="89063" onClick="quick_sms.make('89063','Gunawan','085221005500');" style="display:none;">
relay_quick_sms.php
<?php
$act=$_POST['act'];
$idin=$_POST['idin'];
$nohp=$_POST['nohp'];
$mess=$_POST['mess'];
function convertCharsForHttp($msg) {
$result = $msg;
$result = str_replace("%","%25",$result);
$result = str_replace(" ","%20",$result);
$result = str_replace("!","%21",$result);
$result = str_replace("\"","%22",$result);
$result = str_replace("#","%23",$result);
$result = str_replace("$","%24",$result);
$result = str_replace("&","%26",$result);
$result = str_replace("'","%27",$result);
$result = str_replace("(","%28",$result);
$result = str_replace(")","%29",$result);
$result = str_replace("*","%2A",$result);
$result = str_replace("+","%2B",$result);
$result = str_replace(",","%2C",$result);
$result = str_replace("-","%2D",$result);
$result = str_replace(".","%2E",$result);
$result = str_replace("/","%2F",$result);
$result = str_replace(":","%3A",$result);
$result = str_replace("-","%3B",$result);
$result = str_replace("<","%3C",$result);
$result = str_replace("=","%3D",$result);
$result = str_replace(">","%3E",$result);
$result = str_replace("@","%40",$result);
$result = str_replace("_","%5F",$result);
return $result;
}
$mess=convertCharsForHttp($mess);
//echo "http://$ip:$port/addtrans?tujuan=$receiver&mess=$mess&id_chip=$id_chip&id_server=$id_server&id_app=$id_app&cara_kirim=$cara_kirim&id_ref=$id&id_trans=1";
//echo "java RelayToHttp \"http://$ip:$port/addtrans?tujuan=$receiver&mess=$mess&id_chip=$id_chip&id_server=$id_server&id_app=$id_app&cara_kirim=$cara_kirim&id_ref=$id&id_trans=1\"";
//echo exec("java RelayToHttp \"http://$ip:$port/addtrans?tujuan=$receiver&mess=$mess&id_chip=$id_chip&id_server=$id_server&id_app=$id_app&cara_kirim=$cara_kirim&id_ref=$id&id_trans=1\"");
//echo "java RelayToHttp \"http://192.168.1.23/smscc2/process.php?act=$act&idin=$idin&nohp=$nohp&mess=$mess\"";
//echo "\n";
echo exec("java RelayToHttp \"http://192.168.1.23/smscc2/process.php?act=$act&idin=$idin&nohp=$nohp&mess=$mess\"");
?>
bg83
No comments:
Post a Comment