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.17.175.191
Current Path : /var/www/html/mum/ |
| Current File : /var/www/html/mum/cronjob_sendsms.php |
<?php
//lib16107 lib16103
ini_set('display_errors', 'on');
include("sendsmsapi.php");
ini_set('memory_limit','900M');
ini_set('max_execution_time',0);
$univcode = trim($_GET['funivcode']);
// $univcode = '041';
/*if($univcode == '')
{
die();
}*/
//connect to database
$servername = "97.74.228.93";
$username = "logisys3_logu";
$password = "Logisys@2106";
$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 in('AI','AC') and funivcode in ('041', '042')
and fmobileno is not null";
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
$username = 'logisyhttp';
$password = 'Logis986';
$from = 'UNISOL';
$category = '';
if($count >0)
{
$i = 0;
while($row = mysqli_fetch_assoc($result))
{
$to = $row['mobileno'];
$text = $row['fmessage'];
$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);
$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 in('AI','AC') and fmobileno in ('{$srtImplodedMobs}')";
//var_dump($strUpdateQuery);
$result2 = mysqli_query($conn,$strUpdateQuery);
unset($rgInsert);
$rgInsert = array();
unset($rgTrimedMobs);
$rgTrimedMobs = array();
$i = 0;
}
$i++;
}
$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 in('AI','AC') and fmobileno in ('{$srtImplodedMobs}')";
//var_dump($strUpdateQuery);
$result2 = mysqli_query($conn,$strUpdateQuery);
echo "SMS Sent";
}
?>
|