<?
session_start();
if(strlen($user)<=0)
{
 print "<script> alert('You are not logged in') </script>";
 include("logout.php");
 return;
}
include("../opendb.php");
include("../test.php");
if($sms)
{
//print "Sending sms to ".$mob;
//print "<br><input type=button value='Close' onClick=window.close()>";

//$uurl1="http://api.fastalerts.in/fastclient/SMSclient.php?username=PSNAUTO&password=psn123456&message=".$mesg."&numbers=".$mob;
//$uurl1="http://api.fastalerts.in/fastclient/SMSclient.php?username=PSNAUTO&password=psn123456&message=".$mesg."&numbers=".$mob;
$uurl1="http://sms.psnindia.com/pushsms.php?username=ampl&password=ampl587258&sender=ampl&to=".$mob."&message=".$mesg;
//$uurl1=urlencode($uurl1);
print "<script> x=window.open('$uurl1')";
?>
</script>

<?
return;
}
$sql="select empname,mob from empmaster where empcode='$code'";
$re=mysqli_query($db,$sql) or die(mysqli_error($db));
$cus_row=mysqli_fetch_array($re);
?>

<script>
function count()
 {
  x=document.f1.mesg.value.length;
  if(x>160)
  {
   alert('Message cannot exeed 160 chars');
   return;
  }
 document.f1.cnt.value=x;
}
// window.close();

</script>
<center>
<form name='f1' action='<?print $PHP_SELF?>'>
<table border=1>
<tr><td>Customer </td><td><input type=text name='cust' size=50 readonly value='<?print $cus_row[empname]?>'></td></tr>
<tr><td>Mobile No </td><td><input type=text name='mob' size=20  value='<?print $cus_row[mob]?>'></td></tr>
<tr><td>Message (max 160 char)<br>
Count: <input type=text size=2 name='cnt'></td><td>
<center><font color=red><pre>(No enter key)
<textarea name='mesg' rows=4 cols=49 onKeyUp=count()>Many Many Happy Returns Of The Day - Regards PSN TEAM  </textarea></td></tr>
<tr><td colspan=2 align=center> <input type=submit value='Send SMS Now' name='sms'>
<input type=button value='Cancel' onClick=window.close()> </td></tr>
</table>
</form>
<script>
 function count1()
 {
  x=document.f1.mesg.value.length;
  document.f1.cnt.value=x;
 }
count1();
</script>
