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 : 3.137.219.213


Current Path : /var/www/html/demo/studentportal/src/
Upload File :
Current File : /var/www/html/demo/studentportal/src/smsnotifyx.php

<?php

include ("database.php");
error_reporting(E_ALL);
ini_set('display_errors', 'on');

$case = trim($_POST['case']);//fetch

if($case == 'menu')
{
	$sql = "select fenttype, fevent 
	from sendsms 
	order by forder;"; 

	$result = mysqli_query($conn,$sql);
	
	$menu = array();
	$i = 0;
	while($row1 = $result->fetch_assoc())
	{
		$menu[$i++] = $row1;
	}
	$row['menu'] = $menu;
	$row['error_code'] = 1;
	echo json_encode($row);	
}
else if($case == 'fetch')
{
	include("../sms/sendsmsapi.php");
	$event = trim($_POST['event']);
	$username = 'logisyhttp';
	$password = 'Logis986';
	$from = 'UNISOL';
	$category = '';

	$sql = "select fmobileno, fevent, fmessage 
	from sendsms 
	where fenttype = '{$event}' limit 1"; 

	$result = mysqli_query($conn,$sql);
	$row = $result->fetch_assoc();
	
	$to = explode(",",$row['fmobileno']);

	$text = $row['fmessage'];
	
	foreach ($to as $value) {
		
		$smsresp = sendsmaapi($username,$password,$from,$value,$text,$category);
	}
		
	$row["sms"] = $smsresp;

	if($row["sms"] == "Sent.")
	{
		$row['error_code'] = 1;
		$row['msg'] = "Message was sent Successfully";
	}
	else
	{
		$row['error_code'] = -1;
		$row['msg'] = "Message was not sent as".$row["sms"];
	}

	echo json_encode($row);
}
else if($case == 'send')
{
	include("../sms/sendsmsapi.php");

	$to = trim($_POST['mobile']);
	$text = trim($_POST['text']);

	$username = 'logisyhttp';
	$password = 'Logis986';
	$from = 'UNISOL';
	$category = '';

	//$arr['text'] = $text;

	$smsresp = sendsmaapi($username,$password,$from,$to,$text,$category);

	$row["sms"] = $smsresp;

	if($row["sms"] == "Sent.")
	{
		$row['error_code'] = 1;
		$row['msg'] = "Message was sent Successfully";
	}
	else
	{
		$row['error_code'] = -1;
		$row['msg'] = "Message was not sent as".$row["sms"];
	}
	$row['status'] = 'loggedout';
	echo json_encode($row);
}