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.129.24.240
<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;
if(FPAYMENTYPE == 'EXAM')
window.location.href = `${$host_url}PrintApplicationFormNETBANKING&univcode=${univcode}&app_no=${appno}`;
else if(FPAYMENTYPE == "RVRT")
window.location.href=$host_url+"PrintRevaluationApplicationForm&app_no="+appno+"&univcode="+univcode;
else if(FPAYMENTYPE == "OSER")
window.location.href=$host_url+"printapplicationfrom&app_no="+appno+"&univcode="+univcode;
}
</script>
<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: 0");
include ("database.php");
$funivcode = $_REQUEST['funivcode'];
$get_query = "select * from maspg where funivcode = '{$funivcode}' and fbank = 'Razorpay'";
$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();
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($paymentid);
$api = new Api(RAZORPAY_KEY_ID, RAZORPAY_KEY_SECRET);
$payment = $api->payment->fetch("{$paymentid}");
// var_dump($payment->status);
// var_dump($payment);die();
$get_data = "select * from dbname where ifnull(fdeleted,'') <> 'T' and funivcode = '{$funivcode}'";
$result1=$conn->query($get_data);
if (mysqli_num_rows($result1) > 0)
{
// output data of each row
$dbnames = array();
while($row = mysqli_fetch_assoc($result1))
{
$dbnames[$row['FUNIVCODE']] = $row['FDBNAME'];
$univname = $row['FUNIVNAME'];
$ffolder = $row['FFOLDER'];
}
}
// var_dump($dbnames);
mysqli_close($conn);
$dbname = $dbnames[$payment->notes->univcode];
$pconn = new mysqli(SERVERNAME, USERNAME, PASSWORD,$dbname);
$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';
$typeno = substr($productinfo,0,1);
$type = "";
if($typeno == '1')
$type = 'EXAM';
else if($typeno == '2')
$type = 'RVRT';
else if($typeno == '4')
$type = 'OSER';
echo "<center><h1 >".$univname."</h1></center>";
// die();
$query = "update pgdet set ftxnid = '{$txnid}', fstatus = '{$payment->status}', fupddate = now()
where appno = '{$productinfo}' and forderid = '{$orderid}'";
// $result=$pconn->query($query);
switch($type) {
case 'EXAM':
$pconn->begin_transaction();
$update="update appcandsum set FPAYMENTREMARKS='{$txnid}',FPAYMENTSTATUS='success',
FPAYMENTCONFIRM='success',FACKDATE=now(),FPAYGATEWAY = '{$firstname}',FACKUSER='{$firstname}',
frecptdate = now()
where APPNO='{$productinfo}'";
$result=$pconn->query($update);
if(!$result){
echo "Something went wrong while updating payment";
$pconn->rollback();
die();
}
$get_app_cand_det="SELECT a.FDEGREE,a.FEXAMNO,a.FCOLLCODE,c.FFRESHEXAM,
a.FREGNO,a.FSUBCODE,a.FINSERTED,a.FPRESENT,a.FYEAR,a.FEXAMTYPE,concat('Message from Rani Channamma university : ',
' Dear ',s.fname,' (Reg. no. : ',s.fregno,' , Stud. id. : ',s.fstudid,'),',
' Rs.',FLOOR(c.FTOTALFEE),'/- is received at university. Your application no. is ',c.appno,
'. keep this information for future reference.',' Sent Time: ',time(now())) as message
FROM appcanddet a inner join student s on
a.fregno = s.fregno inner join appcandsum c on a.appno = c.appno
WHERE c.APPNO='{$productinfo}'";
$result = $pconn->query($get_app_cand_det);
if (mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result))
{
$collcode = $row['FCOLLCODE'];
$degree = $row['FDEGREE'];
$regno = $row['FREGNO'];
$text = $row['message'];
$FFRESHEXAM = $row['FFRESHEXAM'];
}
}
// $update_cand_sum = "UPDATE appcandsum a,candsum c
// SET
// c.FEXAMFEEA=if(ifnull(c.FEXAMFEEA,0) <=0,ifnull(a.FEXAMFEEA,0),ifnull(c.FEXAMFEEA,0)),
// c.FEXAMFEEB=if(ifnull(c.FEXAMFEEB,0) <=0,ifnull(a.FEXAMFEEB,0),ifnull(c.FEXAMFEEB,0)),
// c.FEXAMFEEC=if(ifnull(c.FEXAMFEEC,0) <=0,ifnull(a.FEXAMFEEC,0),ifnull(c.FEXAMFEEC,0)),
// c.FEXAMFEED=if(ifnull(c.FEXAMFEED,0) <=0,ifnull(a.FEXAMFEED,0),ifnull(c.FEXAMFEED,0)),
// c.FEXAMFEEE=if(ifnull(c.FEXAMFEEE,0) <=0,ifnull(a.FEXAMFEEE,0),ifnull(c.FEXAMFEEE,0)),
// c.FEXAMFEEF=if(ifnull(c.FEXAMFEEF,0) <=0,ifnull(a.FEXAMFEEF,0),ifnull(c.FEXAMFEEF,0)),
// c.FEXAMFEEG=if(ifnull(c.FEXAMFEEG,0) <=0,ifnull(a.FEXAMFEEG,0),ifnull(c.FEXAMFEEG,0)),
// c.FEXAMFEEH=if(ifnull(c.FEXAMFEEH,0) <=0,ifnull(a.FEXAMFEEH,0),ifnull(c.FEXAMFEEH,0)),
// c.FEXAMFEEI=if(ifnull(c.FEXAMFEEI,0) <=0,ifnull(a.FEXAMFEEI,0),ifnull(c.FEXAMFEEI,0)),
// c.FEXAMFEEJ=if(ifnull(c.FEXAMFEEJ,0) <=0,ifnull(a.FEXAMFEEJ,0),ifnull(c.FEXAMFEEJ,0)),
// c.FTOTALFEE=a.FTOTALFEE,
// c.frecptdate = date(now())
// WHERE a.fregno=c.FREGNO
// AND a.APPNO='{$productinfo}' and a.FCOLLCODE='{$collcode}'";
$update_cand_sum = "UPDATE appcandsumview a,candsum c
SET
c.FEXAMFEEA = a.FEXAMFEEA,
c.FEXAMFEEB = a.FEXAMFEEB,
c.FEXAMFEEC = a.FEXAMFEEC,
c.FEXAMFEED = a.FEXAMFEED,
c.FEXAMFEEE = a.FEXAMFEEE,
c.FEXAMFEEF = a.FEXAMFEEF,
c.FEXAMFEEG = a.FEXAMFEEG,
c.FEXAMFEEH = a.FEXAMFEEH,
c.FEXAMFEEI = a.FEXAMFEEI,
c.FEXAMFEEJ = a.FEXAMFEEJ,
c.FTOTALFEE = a.FTOTALFEE,
c.frecptdate = now()
WHERE a.fregno=c.FREGNO
AND c.fregno = '{$regno}'";
$result = $pconn->query($update_cand_sum);
if(!$result){
echo "Something went wrong while updating payment";
$pconn->rollback();
die();
}
$update_caste = "update candsum c, student s
set c.fcategory = s.fcaste,
c.ffeetype = if(ifnull(c.fconstype,'0123456789') <> '0123456789', 'Low Income', 'Normal Fee')
where s.fregno = c.fregno
and s.fregno = '{$regno}'";
$result = $pconn->query($update_caste);
if(!$result){
echo "Something went wrong while updating payment";
$pconn->rollback();
die();
}
$update_cand_appCand = "update canddet c, appcanddet t
set c.finserted = t.finserted,
c.fpresent = t.fpresent
where c.fdegree = t.fdegree
and c.fexamno = t.fexamno
and c.fregno = t.fregno
and c.fsubcode = t.fsubcode
and c.fdegree = '{$degree}' and c.fregno = '{$regno}'
and t.APPNO='{$productinfo}' and ifnull(c.fpresent,'') <> 'P'";
$result = $pconn->query($update_cand_appCand);
if(!$result){
echo "Something went wrong while updating payment";
$pconn->rollback();
die();
}
$insert_canddet ="insert into canddet(fdegree,FEXAMNO, FCOLLCODE, FREGNO, FSUBCODE, FINSERTED, FPRESENT, FYEAR, FEXAMTYPE)
select fdegree, FEXAMNO, FCOLLCODE,FREGNO, FSUBCODE,FINSERTED, FPRESENT, FYEAR,FEXAMTYPE from appcanddet where
fregno = '{$regno}' and appno ='{$productinfo}' and CONCAT(fdegree,fexamno,fregno,fsubcode)
not in(select CONCAT(fdegree,fexamno,fregno,fsubcode) from canddet where fregno = '{$regno}')
";
$result = $pconn->query($insert_canddet);
$query = "insert into marks (FDEGREE, FEXAMNO, FCOLLCODE, FREGNO, FSUBCODE, fmarks, fyear, fexamtype)
select c.fdegree,c.fexamno,c.fcollcode,c.fregno,
s.fcsubcode,'-1', c.fyear,c.fexamtype
from canddet c inner join
subject s on c.fdegree = s.fdegree and c.fexamno = s.fexamno
and c.fsubcode = s.FSUBCODE
where c.fregno = '{$regno}' and c.fexamno = '{$FFRESHEXAM}'
and c.fcollcode = '{$collcode}' and c.fdegree = '{$degree}'
and s.fintass = 'T' and s.fretain = 'T'";
$res = $pconn->query($query);
$query = "insert into marks_pr (FDEGREE, FEXAMNO, FCOLLCODE,FOCOLLCODE, FREGNO, FSUBCODE, fmarks11, fyear, fexamtype)
select cd.fdegree,cd.fexamno,cd.fcollcode,cd.fcollcode,cd.fregno,s.fcsubcode,'-1',
cd.fyear,cd.fexamtype
from subject s inner join canddet cd on s.fdegree = cd.fdegree
and s.fsubcode = cd.FSUBCODE
and cd.fregno = '{$regno}'
and ifnull(cd.fpassmth,'') = ''
and ifnull(cd.fthpr,'') <> 'F'
where s.fdegree = '{$degree}'
and cd.fcollcode = '{$collcode}'
and s.ftheory = 'F'
and ifnull(s.fintass,'F') <> 'T'";
$res = $pconn->query($query);
if(!$result){
echo "Something went wrong while updating payment";
$pconn->rollback();
die();
}
$update_studfee = "update studfee s, appstudfee a
set s.famount = a.famount,
s.fyear = a.fyear,
s.fexamtype = a.fexamtype,
s.flogdate = a.flogdate
where s.fdegree = a.fdegree
and s.fexamno = a.fexamno
and s.fregno = a.fregno
and s.ffeecode = a.ffeecode
and s.famount <= 0
and s.fregno = '{$regno}' and a.appno ='{$productinfo}'";
$result = $pconn->query($update_studfee);
if(!$result){
echo "Something went wrong while updating payment";
$pconn->rollback();
die();
}
$insert_studfee = "insert into studfee(fdegree,fexamno,fcollcode,fregno,ffeecode,famount,flogdate,fyear,fexamtype)
select fdegree,fexamno,fcollcode,fregno,ffeecode,famount,flogdate,fyear,fexamtype from appstudfee where
fregno = '{$regno}' and appno ='{$productinfo}' and CONCAT(fdegree,fexamno,fregno,ffeecode)
not in(select CONCAT(fdegree,fexamno,fregno,ffeecode) from studfee where fdegree = '{$degree}'
and fregno = '{$regno}')";
$result = $pconn->query($insert_studfee);
if(!$result){
echo "Something went wrong while updating payment";
$pconn->rollback();
die();
}
$pconn->commit();
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}','{$type}');\" >Click here to take a PrintOut</button></div>";
echo $html;
$html ="";
break;
case 'RVRT':
$update = "update res_stud set FPAYMENTREMARKS='{$txnid}',FPAYMENTSTATUS='success',
FPAYMENTCONFIRM='success', fackdate = current_date(), funivrecdate = current_date(),
fackuser = '{$firstname}', FCHALLANNO = '{$orderid}'
where APPNO='{$productinfo}'";
$result = $pconn->query($update);
break;
case 'OSER':
$update = "update servtran set FPAYREMARKS='{$txnid}',
FPAYSTATUS = 'success', FPAYDATE = now(), FTRANID = '{$txnid}',
FPAYMENTTYPE = '{$firstname}'
where FAPPNO = '{$productinfo}'";
$result = $pconn->query($update);
break;
}
}
else
{
$html = "<p>Your payment failed</p>
<p>{$error}</p>";
}
echo $html;
?>
</div>
<br/>
</body>
</html>
|