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.224.43.98


Current Path : /var/www/html/univadmin/
Upload File :
Current File : /var/www/html/univadmin/result_sms_push_rcub.php

<?php
/*
* Api For sending result sms through web export after uploading the result
*

url == http://studentportal.logisys.org/result_sms_push.php
post data == funivcode=003&fdbname=logisys3_kus

*
*/
ini_set('memory_limit','900M');
ini_set('max_execution_time',0);
//include 'database.php';

//connect to database
include("/var/www/config.php");
	$servername = SERVERNAME;
	$username   = USERNAME;
	$password  = PASSWORD;

$conn = new  mysqli($servername,$username,$password);
if(!$conn) 
{
    die("Connection failed: " . mysqli_connect_error());
}

$commondb = "logisys3_comexam";

// Will be sent by mohan sir through web export
//var_dump($commondb);
//die();
$db = 'logisys3_rcu';
$ffolder = 'RCUB';
$univcode = '027';

//Result Push data to common databse

if( $db != '' && $univcode != '')
{
	$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno, fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype,fupdate)
	select distinct '{$univcode}', x.fregno, 'RE', x.fexamno, 
	concat('From {$ffolder}: Dear Student (',x.fregno ,')',', Your result for ',d.fexamname, ' ', 
    d.FRESEXAMDATE, ' exam has been announced. Result: ',
    y.fclass,'. Visit student portal for details - Uniclare') as fmessage, 'F', 'F', x.fyear, x.fexamtype, now() 
	from {$db}.res_fee x
	inner join {$db}.resmarks y
	on  x.fdegree = y.fdegree
	and x.fexamno = y.fexamno
	and x.fregno = y.fregno
	inner join {$db}.degree d
	on x.fdegree = d.fdegree and x.fexamno = d.fexamno
	inner join {$db}.student st 
    on x.fregno = st.fregno 
	where x.fresultdate = date_format(now(),'%Y-%m-%d')";

	//3.25	

	$result1 = mysqli_query($conn, $sql1);

	if($result1)
	{
		$sql1 = "update {$commondb}.sendsms x, {$commondb}.masuser y set x.fmobileno = y.fmobileno
		where x.funivcode = y.funivcode and x.fregno = y.fregno and
        ifnull(x.fmobileno,'') = ''
        and x.funivcode = '{$univcode}' and y.funivcode = '{$univcode}' and x.fenttype = 'RE'";
		
		$result2 = mysqli_query($conn, $sql1);

		$sql1 = "update {$db}.res_fee x set x.frespush = 'T'
		where x.fresultdate = date_format(now(),'%Y-%m-%d')
		and ifnull(x.frespush,'') <> 'T'";
		
		$result3 = mysqli_query($conn, $sql1);

		echo "success";
	}
	else
	{	
		echo "failure";
	}	
}

?>