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


Current Path : /proc/thread-self/root/var/www/html/admission/
Upload File :
Current File : //proc/thread-self/root/var/www/html/admission/verify.php

<html>

<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"
    integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

<script type="text/javascript">

var $host_url = `http://${window.location.host}/app.php?a=`;


function printExamApp(appno, univcode, FPAYMENTYPE) {
    //window.location.href=$host_url+"PrintApplicationFormPOSTOFFICE&app_no="+app_no;
    window.open(`${$host_url}admFeeReport&univcode=${univcode}&app_no=${appno}`);
}
</script>

<?php
ini_set('display_errors', 1);
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: 0");
include("sendGridMail.php");

include("consts.php");
$SERVERNAME = SERVERNAME;
$USERNAME   = USERNAME;
$PASSWORD  = PASSWORD;
$DATABASE = "logisys3_comexam";

$conn = new mysqli($SERVERNAME, $USERNAME, $PASSWORD, $DATABASE);
if(!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
// include("sendsmsapiv1.php");

$funivcode = $_REQUEST['funivcode'];
$appno = $_REQUEST['appno'];
$degree = $_REQUEST['degree'];
$fheadcode = $_REQUEST['fheadcode'];


$get_query = "select * from dbname where funivcode = '{$funivcode}'";
$result1=$conn->query($get_query); 

$pgcred = mysqli_fetch_assoc($result1);

$DATABASE = $pgcred['FDBNAME'];
$univname = $pgcred['FUNIVNAME'];
$conn = new mysqli($SERVERNAME, $USERNAME, $PASSWORD, $DATABASE);
if(!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}


$get_query = "select * from maspg 
where funivcode = '{$funivcode}' and fenttype='{$degree}'";
$result1=$conn->query($get_query); 

$pgcred = mysqli_fetch_assoc($result1);


define("RAZORPAY_KEY_ID", $pgcred['fkey']);
define("RAZORPAY_KEY_SECRET", $pgcred['fworkingid']);
require('razorpay/config.php');

session_start();
$studemail = $_SESSION['MOBILE'];
require('razorpay/razorpay-php/Razorpay.php');
use Razorpay\Api\Api;
use Razorpay\Api\Errors\SignatureVerificationError;

$success = true;

$error = "Payment Failed";


if (empty($_POST['razorpay_payment_id']) === false)
{
    $api = new Api(RAZORPAY_KEY_ID, RAZORPAY_KEY_SECRET);
    try
    {
        // Please note that the razorpay order ID must
        // come from a trusted source (session here, but
        // could be database or something else)
        $attributes = array(
            'razorpay_order_id' => $_SESSION['razorpay_order_id'],
            'razorpay_payment_id' => $_POST['razorpay_payment_id'],
            'razorpay_signature' => $_POST['razorpay_signature']
        );

        $api->utility->verifyPaymentSignature($attributes);
    }
    catch(SignatureVerificationError $e)
    {
        $success = false;
        $error = 'Razorpay Error : ' . $e->getMessage();
    }
}

if ($success === true)
{

    
    $html = "<p>Your payment was successful</p>
             <p>Payment ID: {$_POST['razorpay_payment_id']}</p>";

    $paymentid = $_POST['razorpay_payment_id'];
    // var_dump($_POST);
    $api = new Api(RAZORPAY_KEY_ID, RAZORPAY_KEY_SECRET);

    $payment = $api->payment->fetch("{$paymentid}");
    
    $status = "success";
    $productinfo = $payment->notes->appno;
    $txnid = $payment->id;
    // $orderid = $payment->order_id;
    $orderid = $payment->order_id;
    $payment['TXNAMOUNT'] = ((float)$payment->amount/100);

    $firstname = 'razorpay';
 
    echo "<center><h1 >".$univname."</h1></center>";
    // die();

    echo "<div style = 'width:50%; margin:10% auto'>
        <h4 style='color:green;'>Thank You. Your order status is success</h4>";


        echo "<h4>Your Transaction ID for this transaction is : ".$txnid.".</h4>";
        echo "<h4>We have received a payment of Rs. : " . $payment['TXNAMOUNT']  ."</h4>";
        $html="<button type='button' class='btn btn-primary w-10' onclick=\"printExamApp('{$productinfo}','{$funivcode}','{$degree}');\" >Click here to take a PrintOut</button></div>";
        echo $html;
        $html ="";
    
    
    if($fheadcode == 'App'){
        $cond = 'adm_lead';
        $cond1 = ",fappfeestatus = 'T'";
        $cond2 = 'fleadid';
    }else{
        $cond = 'adm_stud';
        $cond1 = ",fpaymentstatus = 'T'";
        $cond2 = 'FAPPNO';
    }
    
    $query = "update pgdet set ftxnid = '{$txnid}', fstatus = '{$payment->status}', fupddate = now() 
    where appno = '{$productinfo}' and forderid = '{$orderid}'";
    $rest = $conn->query($query); 
      
    $update = "update adm_studfeesum set forderid = '{$orderid}', fpaytype='Online', FPAYREMARKS='{$txnid}',
            FPAYSTATUS='success',FPAYDATE=now(),FTRANID='{$txnid}' 
            where $cond2='{$productinfo}'"; 
            
    $result = $conn->query($update); 

    $qry1 = "select $cond2 as fappno, ifnull(famount, 0)as fpaid 
    from adm_studfeesum where $cond2='{$productinfo}'";
    $res1 = $conn->query($qry1); 
    $row1 = mysqli_fetch_assoc($res1);
    $regno = $row1['fappno'];
    $amt = $row1['fpaid'];
    
    $qry = "select concat(a.fdegree, ' - ', fdescpn)as fdegree, ifnull(famount, 0)as famount, ifnull(fname, '')as fname, 
            ifnull(fgender, '')as fgender, ifnull(a.fadmyear, '')as fadmyear,
            ifnull(ffatname, '')as ffatname
            from $cond a inner join degree d on d.fdegree  = a.fdegree 
            where $cond2 = '{$productinfo}'
            group by a.fdegree";
    $resQry = $conn->query($qry); 
    $rowQry = mysqli_fetch_assoc($resQry);

    $stud_Amt = floatval($amt) + floatval($rowQry['famount']);
    $fname = $rowQry['fname'];
    $fgender = $rowQry['fgender'];
    $fadmyear = $rowQry['fadmyear'];
    $ffatname = $rowQry['ffatname'];
    $course = $rowQry['fdegree'];

    if($fheadcode == 'App'){
        $studFeeUpd = "update adm_lead set fapppayid='{$txnid}', 
        fapppaydate=now(), fappfeestatus = 'T' where fleadid ='{$regno}'";
    }else{
        $studFeeUpd = "update adm_stud set fpaymentid='{$txnid}', 
        fpaymentdate=now(), fpaymentstatus = 'T' where FAPPNO ='{$regno}'";
    }
    
    $res = $conn->query($studFeeUpd); 

    $qry2 = "select ifnull(famount, 0) as paid from 
            adm_studfeesum where $cond2 = '{$regno}' 
            and ifnull(FPAYSTATUS,'') = 'success' 
            and fintno='{$productinfo}'";

    $res2 = $conn->query($qry2); 
    $row2 = mysqli_fetch_assoc($res2);
    $amount = $row2['paid'];

    $qry3 = "select fdegree, fappno, fheadcode, ffee, fbal, 
            ifnull(fpaid, 0)as fpaid from adm_studfee where $cond2 = '{$regno}' 
            and ifnull(fbal,0) >0 order by fheadcode";
    $res3 = $conn->query($qry3); 

    $colldet = "select ifnull(FUNIVNAME,'') as FUNIVNAME, concat(ifnull(FUNIVADD1,'') ,',', ifnull(FUNIVADD2,'')) as FUNIVADD,
	ifnull(FTOWN,'') as FTOWN, ifnull(funivemail,'') as funivemail,
	ifnull(funivmobile,'') as funivmobile,ifnull(fadmlink,'') as fadmlink,
	ifnull(fadmname, '') as fadmname,ifnull(fadmemail,'') as fadmemail
	from control";
	$re = $conn->query($colldet); 
    $collres = mysqli_fetch_assoc($re);
    $fcollname = $collres['FUNIVNAME'];
	$fadmlink = $collres['fadmlink'];
	$fadmname = $collres['fadmname'];
	$fadmemail = $collres['fadmemail'];
    $studemail = $_SESSION['MOBILE'];
    $fadmltr = explode('/',$fadmlink);
    $link = $fadmltr[2]."/app.php?&a=admFeeReport&univcode={$funivcode}&app_no={$appno}";

    if($fgender == 'F'){
        $cnd = " <b>Miss ".strtoupper($fname)." </b>";
        $cnd1 = " <b>D/o ".strtoupper($ffatname)." </b>";
    }else{
        $cnd = " <b>Mr. ".strtoupper($fname)." </b>";
        $cnd1 = " <b>S/o ".strtoupper($ffatname)." </b>";
    }   

    $admAdd = intval($fadmyear) + 1;
    $admyear = $fadmyear ." - ". $admAdd;

    // $link = "https://admissions.harshainstitutions.com/app.php?&a=admFeeReport&univcode={$funivcode}&app_no={$appno}";

    $message = "";
    $logo = "https://universitysolutions.in/admission/img/".$funivcode."_logo.jpg";
    $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.="<center><img src='{$logo}' height='100px' width='250px' /></center>";
    $message.="<p style='text-align:end;'>Date: ".date("d/m/Y")."</p>";
    // $message.="<h3 style='text-align:center;'>PROVISIONAL ADMISSION CONFIRMATION</h3>";
    // $message.="<p>This is to certify that".$cnd.$cnd1."has been provisionally admitted in our institution for study in <b>" .$course. "</b> course for the academic year <b>". $admyear ."</b> through merit basis and final confirmation of the admission is subjected to the payment of full fee, submission of original documents and approval of admission from the university concerned.</p>";
    $message.="<h3>Thank You for the payment.</h3>";
    $message.="<p>Download your application: <a href='{$link}'>Download</a></p>";
    $message.="</body>";
    $subject= strtoupper($fcollname); 
    $resp = sendGridMail($studemail, $subject, $message, $funivcode);  

    if(mysqli_num_rows($res3) > 0){
        while($row3 = mysqli_fetch_assoc($res3)){
            $headcode = $row3['fheadcode'];
            $bal = $row3['fbal'];
            $paid = $row3['fpaid'];
            $amount = $payment['fee'];
            
            if($bal >= $amount){
                $balance = floatval($bal) - floatval($amount);
                $paid = floatval($paid) + floatval($amount);
                $amount = 0;
                
                $qry4 = "update adm_studfee set fpaid='{$paid}', fbal='{$balance}'
                where $cond2 = '{$regno}' and fheadcode='{$headcode}'";
                $res4 = $conn->query($qry4); 
            } else if($amount > $bal){
                $balance = floatval($amount) - floatval($bal);
                $amount = $balance;
                $paid = floatval($bal) + floatval($paid);
                $balan = 0;
                $qry4 = "update adm_studfee set fpaid='{$paid}', fbal='{$balan}' 
                where $cond2 = '{$regno}' and fheadcode='{$headcode}'";
                $res4 = $conn->query($qry4);
            }
        }
    }

}
else
{
    $html = "<p>Your payment failed</p>
             <p>{$error}</p>";
}

echo $html;
?>
</div>
<br />
</body>

</html>