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.145.110.145
<?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';
//include("/var/www/config.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";
$db = 'logisys3_nmamit';
$ffolder = 'Nitte';
$univcode = '049';
//Re
//Result Push data to common databse
if( $db != '' && $univcode != '')
{
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno,fmobileno, fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype,fupdate)
select distinct '{$univcode}', st.fregno,st.ffatmob, 'ATT', concat('ATT',date_format(now(),'%d/%m/%Y')) as sub,
concat('From ',if(st.fcollcode = '1001','NMAMIT','NSAMFGC'),' NITTE: Dear Parent, ',st.fname,' (USN : ',st.fregno,') is absent for the ',group_concat(s.FSUBSHORT SEPARATOR ', '),' courses on ',date_format(now(),'%d/%m/%Y'),' - Uniclare') as fmessage, 'F', 'F', a.fyear, a.fexamtype, now()
from {$db}.attend_det a inner join {$db}.subject s on a.fdegree = s.fdegree and
a.fexamno=s.fexamno and a.fsubcode = s.fcsubcode
inner join {$db}.student st on a.fregno = st.fregno
where FPRESENT ='A'
and ifnull(st.ffatmob,'') <>''
and length(st.ffatmob) = 10
and st.fcollcode = '1001'
and a.fdate = date_format(now(),'%Y-%m-%d')
group by fregno";
$result1 = mysqli_query($conn, $sql1);
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno,fmobileno, fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype,fupdate)
select distinct '{$univcode}', st.fregno,st.ffatmob, 'ATT1', concat('ATT1',date_format(now(),'%d/%m/%Y')) as sub,
concat('From ',if(st.fcollcode = '1001','NMAMIT','NSAMFGC'),' NITTE: Dear Parent, ',st.fname,' (USN : ',st.fregno,') is absent for the ',group_concat(s.FSUBSHORT SEPARATOR ', '),' courses on ',date_format(now(),'%d/%m/%Y'),' - Uniclare') as fmessage, 'F', 'F', a.fyear, a.fexamtype, now()
from {$db}.attend_det a inner join {$db}.subject s on a.fdegree = s.fdegree and
a.fexamno=s.fexamno and a.fsubcode = s.fcsubcode
inner join {$db}.student st on a.fregno = st.fregno
where FPRESENT ='A'
and ifnull(st.ffatmob,'') <>''
and length(st.ffatmob) = 10
and st.fcollcode = '1002'
and a.fdate = date_format(now(),'%Y-%m-%d')
group by fregno";
$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";
}
}
?>
|