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.107.223
Current Path : /var/www/html/sms/ |
| Current File : /var/www/html/sms/cronjob_sendmail.php |
<?php
//lib16107 lib16103
ini_set('display_errors', 'on');
ini_set('memory_limit','900M');
ini_set('max_execution_time',0);
include("sendGridMail.php");
include("sendsmsapi.php");
$servername = "97.74.228.93";
$username = "logisys3_logu";
$password = "Logisys@2106";
/*$servername = "localhost";
$username = "root";
$password = "";*/
$conn = new mysqli($servername,$username,$password);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$query = "select * from logisys3_grv.masuniv";
$result3 = mysqli_query($conn,$query);
$count = mysqli_num_rows($result3);
if($count >0)
{
while($row3 = mysqli_fetch_assoc($result3))
{
$admdb = $row3['fdbname'];
$funivname = $row3['funivname'];
$query = "SELECT fcollcode, fprincipalname, CONCAT(FCOLLNAME,', ',FTOWN) AS fcollname,
IFNULL(fmobile,''),IFNULL(femail,'') as femail
FROM {$admdb}.college WHERE fdeleted <> 'T' AND IFNULL(femail,'') <> '' and ifnull(fdeleted,'') <> 'T' order by fcollcode";
$result = mysqli_query($conn,$query);
$count = mysqli_num_rows($result);
if($count >0)
{
$i = 0;
while($row = mysqli_fetch_assoc($result))
{
$fcollcode = $row['fcollcode'];
$femail = $row['femail'];
//$femail = "mohanlyrix@gmail.com";
//$femail = "arun.v@logisys.org";
$cc = "bcureply@gmail.com";
$subject = $fcollcode." - Admission Statistics (2018)";
$query1 = "SELECT c.fcollcode, c.fdegree, a.fdescpn AS fdescpn, COUNT(c.fmobileno) AS fcount,
SUM(IF(IFNULL(c.factive,'') = 'T',1,0)) AS factive,IFNULL(fentered,0) AS fentered,
IFNULL(finsubdone,0) AS ffinsubdone, IFNULL(fackdone,0) AS fackdone,
ifnull(fackpending,0) as fackpending
FROM {$admdb}.collstud c
LEFT JOIN (SELECT COUNT(fappno) AS fentered, fcollcode, fdegree
FROM {$admdb}.studadm
WHERE fcollcode = '{$fcollcode}' and ifnull(fdeleted,'') <> 'T'
GROUP BY fdegree) d ON c.fcollcode = d.fcollcode
AND c.fdegree = d.fdegree LEFT JOIN (SELECT COUNT(fappno) AS finsubdone, fcollcode, fdegree
FROM {$admdb}.studadm
WHERE fcollcode = '{$fcollcode}' AND IFNULL(ffinsub,'') = 'T' and ifnull(fdeleted,'') <> 'T'
GROUP BY fdegree) e ON c.fcollcode = e.fcollcode
AND c.fdegree = e.fdegree LEFT JOIN (SELECT IFNULL(COUNT(fappno),0) AS fackdone, fcollcode, fdegree
FROM {$admdb}.studadm WHERE fcollcode = '{$fcollcode}' AND IFNULL(ffinsub,'') = 'T'
AND IFNULL(fappstatus,'') = 'verified' and ifnull(fdeleted,'') <> 'T'
GROUP BY fdegree) f ON c.fcollcode = f.fcollcode AND c.fdegree = f.fdegree
LEFT JOIN (SELECT IFNULL(COUNT(fappno),0) AS fackpending, fcollcode, fdegree
FROM {$admdb}.studadm WHERE fcollcode = '{$fcollcode}' AND IFNULL(ffinsub,'') = 'T'
AND IFNULL(fappstatus,'') <> 'verified' and ifnull(fdeleted,'') <> 'T'
GROUP BY fdegree) x ON c.fcollcode = x.fcollcode AND c.fdegree = x.fdegree
INNER JOIN {$admdb}.degree a ON c.fdegree = a.fdegree AND a.fexamno = 'A'
WHERE c.fcollcode = '{$fcollcode}' and ifnull(c.fdeleted,'') <> 'T'
GROUP BY c.fcollcode, c.fdegree";
$result1 = mysqli_query($conn,$query1);
//var_dump($result1);
$table = '<center><h2>'.$funivname.'</h2>
<h2>Admission Statistics</h2>
<table style="margin-left:2px;text-align: left;width: 100%" border="1" cellpadding="10" cellspacing="0" >
<thead>
<tr style = "background-color:#8acc51">
<th width="5%" align="center"><b>Sl. No.</b></th>
<th width="8%" align="center"><b>Degree Code</b></th>
<th width="40%" align="left"><b>Degree Name</b></th>
<th align="center"><b>No. of Students</b></th>
<th align="center"><b>Students Registered</b></th>
<th align="center"><b>Adm. Uploaded</b></th>
<th align="center"><b>Adm. Pending</b></th>
<th align="center"><b>Ack. Done</b></th>
<th align="center"><b>Ack. Pending</b></th>
</tr>
</thead>
<tbody>';
$y = 1;
$totfcount = 0;
$totfactive = 0;
$totfentered = 0;
$totffinsubdone = 0;
$totfackdone = 0;
$fackpending = 0;
while($row = mysqli_fetch_assoc($result1))
{
$totfcount += $row['fcount'];
$totfactive += $row['factive'];
$row['fentered'] = intval($row['fcount']) - intval($row['ffinsubdone']);
$totfentered += $row['fentered'];
$totffinsubdone += $row['ffinsubdone'];
$totfackdone += $row['fackdone'];
$fackpending += $row['fackpending'];
$table .= '<tr>
<th align="center">'.$y.'</th>
<th align="center">'.$row ['fdegree'].'</th>
<th align="left">'.$row ['fdescpn'].'</th>
<th align="center">'.$row ['fcount'].'</th>
<th align="center">'.$row ['factive'].'</th>
<th align="center">'.$row ['ffinsubdone'].'</th>
<th align="center">'.$row ['fentered'].'</th>
<th align="center">'.$row ['fackdone'].'</th>
<th align="center">'.$row ['fackpending'].'</th>
</tr>';
$y++;
}
$table .= '<tr>
<td align="center" colspan="3"><b>Total</b></td>
<td align="center"><b>'.$totfcount.'</b></td>
<td align="center"><b>'.$totfactive.'</b></td>
<td align="center"><b>'.$totffinsubdone.'</b></td>
<td align="center"><b>'.$totfentered.'</b></td>
<td align="center"><b>'.$totfackdone.'</b></td>
<td align="center"><b>'.$fackpending.'</b></td>
</tr></tbody></table>';
echo $table;
//$emails = ['prashanth.k@logisys.org','arun.v@logisys.org', 'mohanlyrix@gmail.com', 'hnnagaraj@lordshire.com', 'hnramesh@logisys.org'];
//for($i=0;$i< count($emails); $i++)
//{
//$femail = $emails[$i];
$resp = sendGridMail($femail,$subject,$table,$cc);
//echo $resp;
//}
}
}
/*$emails = ['prashanth.k@logisys.org','arun.v@logisys.org'];
for($i=0;$i< count($emails); $i++)
{
$femail = $emails[$i];
$resp = sendGridMail($femail,$subject,$table,$cc);
echo $resp;
}*/
}
}
?>
|