Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.144.235.195
<?php
//lib16107 lib16103
ini_set('display_errors', 'on');
include("sendsmsapi.php");
ini_set('memory_limit','900M');
ini_set('max_execution_time',900);
if(!isset($_GET['funivcode']) || !isset($_GET['fevent']))
{
echo "<center><h2 style='color: red'>Invalid Parameters<h2></center>";
die();
}
$univcode = trim($_GET['funivcode']);
$fevent = trim($_GET['fevent']);
//connect to database
$servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
$username = "admin";
$password = "Logisys2104";
// $servername = "192.168.0.32";
// $username = 'admin';
// $password = "admin";
$conn = new mysqli($servername,$username,$password);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$commondb = "logisys3_comexam";
$query = "select funivcode, fregno, fenttype, fmobileno as mobileno,
concat(fmessage, ' Sent Time: ',time(now())) as fmessage
from {$commondb}.sendsms
where ifnull(fstatus, 'F') = 'F' and fenttype = '{$fevent}'
and funivcode = '{$univcode}'
and fmobileno is not null";
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
// $row = mysqli_fetch_assoc($result);
$username = 'logisyhttp';
$password = 'logisy@928';
$from = 'UNISOL';
$category = '';
if($count >0)
{
$i = 0;
$text = "";
$j = 1;
$table = '
<style>
table{
width:100%;
table-layout: fixed;
}
</style>
<table style="text-align: left;width: 100%;" border="1" cellpadding="10" cellspacing="0" >
<thead style = "">
<tr style = "background-color:#8acc51">
<th width="5%" align="center"><b>Sl. No.</b></th>
<th width="8%" align="center"><b>Reg. No. / Mobile No.</b></th>
<th width="10%" align="center"><b>Mobile No.</b></th>
<th width="10%" align="center"><b>Status</b></th>
</tr>
</thead>
<tbody>';
echo $table;
// $row = mysqli_fetch_assoc($result);
// var_dump($row);
while($row = mysqli_fetch_assoc($result))
{
$to = $row['mobileno'];
$text = $row['fmessage'];
$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);
// $smsresp = 'Sent.';
$table = '<tr>
<td width="5%" align="center">'.$j.'</td>
<td width="8%" align="center">'.$row['fregno'].'</td>
<td width="10%" align="center">'.$to.'</td>
<td width="10%" align="center">'.$smsresp.'</td>
</tr>';
echo $table;
$j++;
$rgInsert[] = "('".$row['funivcode']."','".$row['fregno']."','{$to}','0','{$smsresp}','".$row['fenttype']."','T', DATE_FORMAT(NOW(),'%Y-%m-%d'), DATE_FORMAT(NOW(),'%T'))";
$rgTrimedMobs[$i] = $to;
if($i == 50)
{
$strInsertQuery = "insert into {$commondb}.smslog(funivcode, fregno,fmobileno, freasoncode, fguid, fenttype, fstatus,fackdate, facktime) values".implode(',',$rgInsert);
//var_dump($strInsertQuery);
$result1 = mysqli_query($conn,$strInsertQuery);
$srtImplodedMobs = implode("','",$rgTrimedMobs);
$strUpdateQuery = "update {$commondb}.sendsms set fstatus = 'T' where fenttype = '{$fevent}'
and fmobileno in ('{$srtImplodedMobs}')";
//var_dump($strUpdateQuery);
$result2 = mysqli_query($conn,$strUpdateQuery);
unset($rgInsert);
$rgInsert = array();
unset($rgTrimedMobs);
$rgTrimedMobs = array();
$i = 0;
}
$i++;
}
echo "</tbody></table>";
$strInsertQuery = "insert into {$commondb}.smslog(funivcode,fregno,fmobileno, freasoncode, fguid, fenttype, fstatus,fackdate, facktime) values".implode(',',$rgInsert);
//var_dump($strInsertQuery);
$result1 = mysqli_query($conn,$strInsertQuery);
$srtImplodedMobs = implode("','",$rgTrimedMobs);
$strUpdateQuery = "update {$commondb}.sendsms set fstatus = 'T'
where fenttype = '{$fevent}' and fmobileno in ('{$srtImplodedMobs}')";
//var_dump($strUpdateQuery);
$result2 = mysqli_query($conn,$strUpdateQuery);
$username = 'logisyhttp';
$password = 'logisy@928';
$from = 'UNISOL';
$category = 'bulk';
//pg test
//$to = "919741089633,918277684424,919844020272,919845532688,919480278729,919886494428,919900120447,919986554632";
//PHD
//$to = "919741089633,918277684424,919844020272,919845532688,919480278729,919449259058,919986554632";
//Arun and Prashant, mohan, ramesh, mahesh
// $to = "919741089633,918277684424,919845532688,919844020272,919986554632";
// Arun and Prashant, mohan, ramesh, mahesh
$to = "919741089633,918277684424";
$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);
echo $smsresp;
}
?>
|