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.116.85.96
<?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;
// $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
$unicode = $_GET['univcode'];
if($unicode == '')
{
echo "Univ Code Empty";
die();
}
if($unicode == '027')
{
$db = 'logisys3_rcu';
$ffolder = 'RCUB';
$univcode = '027';
}else if($unicode == '041')
{
$db = 'logisys3_bcu';
$ffolder = 'BCU';
$univcode = '041';
}
else if($unicode == '003')
{
$db = 'logisys3_kus';
$ffolder = 'KUS';
$univcode = '003';
}
else if($unicode == '042')
{
$db = 'logisys3_bnu';
$ffolder = 'BNU';
$univcode = '042';
}
else if($unicode == '023')
{
$db = 'logisys3_dud';
$ffolder = 'DUD';
$univcode = '023';
}
else if($unicode == '003D')
{
$db = 'logisys3_kusd';
$ffolder = 'KUSDDE';
$univcode = '003D';
}else if($unicode == '043')
{
$db = 'logisys3_gfgcg';
$ffolder = 'GFGCG';
$univcode = '043';
}else if($unicode == '046')
{
$db = 'logisys3_gach';
$ffolder = 'GACH';
$univcode = '046';
}else if($unicode == '037')
{
$db = 'logisys3_gsh';
$ffolder = 'GSH';
$univcode = '037';
}
else if($unicode == '035')
{
$db = 'logisys3_gcc';
$ffolder = 'GCC';
$univcode = '035';
}
else if($unicode == '033')
{
$db = 'logisys3_gcg';
$ffolder = 'GCG';
$univcode = '033';
}
else if($unicode == '034')
{
$db = 'logisys3_gcw';
$ffolder = 'GCW';
$univcode = '034';
}else if($unicode == '049')
{
$db = 'logisys3_nmamit';
$ffolder = 'NITTE (DU)';
$univcode = '049';
}else if($unicode == '050')
{
$db = 'logisys3_srun';
$ffolder = 'SRUN';
$univcode = '050';
}else if($unicode == '051')
{
$db = 'logisys3_dypatil';
$ffolder = 'DYPATIL';
$univcode = '051';
}else if($unicode == '052')
{
$db = 'logisys3_jssstu';
$ffolder = 'JSS STU';
$univcode = '052';
}else if($unicode == '021')
{
$db = 'logisys3_jssu';
$ffolder = 'JSS AHER';
$univcode = '021';
}else if($unicode == '054')
{
$db = 'logisys3_mfgc';
$ffolder = 'MFGC';
$univcode = '054';
}else if($unicode == '055')
{
$db = 'logisys3_sjbit';
$ffolder = 'SJBIT';
$univcode = '055';
}else if($unicode == '060')
{
$db = 'logisys3_surana';
$ffolder = 'SURANA';
$univcode = '060';
}
//Re
//Result Push data to common databse
if( $db != '' && $univcode != '')
{
if($univcode == '049')
{
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno,fmobileno, fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype,fupdate)
select distinct '{$univcode}', x.fregno,m.fmobileno, 'RE', concat(x.fyear,x.fexamtype,x.fexamno),
concat('From {$ffolder}: Dear Student (',x.fregno ,')',', Your result for ',
left(de.fexamdate,30), ' exam has been announced. Visit student portal for details - Logisys') 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
and x.fyear = y.fyear and x.fexamtype = y.fexamtype
inner join {$db}.degexam de on y.fdegree = de.fdegree and de.fexamno = y.fexamno
and y.fyear = de.fyear and y.fexamtype = de.fexamtype
inner join {$db}.student st
on x.fregno = st.fregno
inner join logisys3_comexam.masuser m on x.fregno = m.fregno
and m.funivcode = '{$univcode}'
where x.fresultdate = date_format(now(),'%Y-%m-%d')
and ifnull(x.frespush,'') <> 'T'";
$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}', x.fregno,m.fmobileno, 'RE', concat(x.fyear,x.fexamtype,x.fexamno),
concat('From {$ffolder}: Dear Student (',x.fregno ,')',', Your result for ',
left(de.fexamdate,30), ' exam has been announced. Visit student portal for details - Logisys') 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
and x.fyear = y.fyear and x.fexamtype = y.fexamtype
inner join {$db}.degexam de on y.fdegree = de.fdegree and de.fexamno = y.fexamno
and y.fyear = de.fyear and y.fexamtype = de.fexamtype
inner join {$db}.student st
on x.fregno = st.fregno
inner join logisys3_comexam.masuser m on x.fregno = m.fregno
and m.funivcode = '{$univcode}'
and ifnull(m.ftype,'') = 'P'
where x.fresultdate = date_format(now(),'%Y-%m-%d')
and ifnull(x.frespush,'') <> 'T'";
$result1 = mysqli_query($conn, $sql1);
}else if($univcode == '052')
{
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno,fmobileno, fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype,fupdate)
select distinct '{$univcode}', x.fregno,m.fmobileno, 'RE', concat(x.fyear,x.fexamtype,x.fexamno),
concat('From {$ffolder}: Dear Student (',x.fregno ,')',', Your result for ',
left(de.fexamdate,30), ' exam has been announced. Visit student portal for details - Logisys') 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
and x.fyear = y.fyear and x.fexamtype = y.fexamtype
inner join {$db}.degexam de on y.fdegree = de.fdegree and de.fexamno = y.fexamno
and y.fyear = de.fyear and y.fexamtype = de.fexamtype
inner join {$db}.student st
on x.fregno = st.fregno
inner join logisys3_comexam.masuser m on x.fregno = m.fregno
and m.funivcode = '{$univcode}'
and ifnull(m.ftype,'') <> 'P'
where x.fresultdate = date_format(now(),'%Y-%m-%d')
and ifnull(x.frespush,'') <> 'T'";
$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}', x.fregno,m.fmobileno, 'RE', concat('P',x.fyear,x.fexamtype,x.fexamno),
concat('From {$ffolder}: Dear Student (',x.fregno ,')',', Your result for ',
left(de.fexamdate,30), ' exam has been announced. Visit student portal for details - Logisys') 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
and x.fyear = y.fyear and x.fexamtype = y.fexamtype
inner join {$db}.degexam de on y.fdegree = de.fdegree and de.fexamno = y.fexamno
and y.fyear = de.fyear and y.fexamtype = de.fexamtype
inner join {$db}.student st
on x.fregno = st.fregno
inner join logisys3_comexam.masuser m on x.fregno = m.fregno
and m.funivcode = '{$univcode}'
and ifnull(m.ftype,'') = 'P'
where x.fresultdate = date_format(now(),'%Y-%m-%d')
and ifnull(x.frespush,'') <> 'T'";
$result1 = mysqli_query($conn, $sql1);
}else if($univcode == '021')
{
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno,fmobileno, fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype,fupdate)
select distinct '{$univcode}', x.fregno,m.fmobileno, 'RE', concat(x.fyear,x.fexamtype,x.fexamno),
concat('From {$ffolder}: Dear Student (',x.fregno ,')',', Your result for ',
left(de.fexamdate,30), ' exam has been announced. Visit student portal for details - Logisys') 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
and x.fyear = y.fyear and x.fexamtype = y.fexamtype
inner join {$db}.degexam de on y.fdegree = de.fdegree and de.fexamno = y.fexamno
and y.fyear = de.fyear and y.fexamtype = de.fexamtype
inner join {$db}.student st
on x.fregno = st.fregno
inner join logisys3_comexam.masuser m on x.fregno = m.fregno
and m.funivcode = '{$univcode}'
and ifnull(m.ftype,'') <> 'P'
where x.fresultdate = date_format(now(),'%Y-%m-%d')
and ifnull(x.frespush,'') <> 'T'";
$result1 = mysqli_query($conn, $sql1);
}
else
{
$sql1 = "insert ignore into {$commondb}.sendsms(funivcode, fregno,fmobileno, fenttype, fsubcode, fmessage, fstatus, fdeleted, fyear, fexamtype,fupdate)
select distinct '{$univcode}', x.fregno,m.fmobileno, 'RE', concat(x.fyear,x.fexamtype,x.fexamno),
concat('From {$ffolder}: Dear Student (',x.fregno ,')',', Your result for ', left(de.fexamdate,30), ' exam has been announced. Visit student portal for details - Logisys') 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
and x.fyear = y.fyear and x.fexamtype = y.fexamtype
inner join {$db}.degexam de on y.fdegree = de.fdegree and de.fexamno = y.fexamno
and y.fyear = de.fyear and y.fexamtype = de.fexamtype
inner join {$db}.student st
on x.fregno = st.fregno
inner join logisys3_comexam.masuser m on x.fregno = m.fregno
and m.funivcode = '{$univcode}'
where x.fresultdate = date_format(now(),'%Y-%m-%d')
and ifnull(x.frespush,'') <> 'T'";
$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";
}
}
?>
|