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.38.150
<?php
include ("../database.php");
include ("../consts.php");
session_start();
$funivcode = $_POST['funivcode'];
$appno = $_POST['appno'];
$degree = $_POST['degree'];
$fheadcode = $_POST['fheadcode'];
include("/var/www/config.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());
}
$query = "select * from dbname where ifnull(fdeleted,'') <> 'T' and funivcode = '{$funivcode}'";
$res = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($res);
$DATABASE = $row['FDBNAME'];
$conn = new mysqli($SERVERNAME, $USERNAME, $PASSWORD, $DATABASE);
if(!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$get_query = "select * from maspg where funivcode = '{$funivcode}' and fbank = 'Razorpay' and FENTTYPE = '{$degree}'";
$result1=$conn->query($get_query);
$pgcred = mysqli_fetch_assoc($result1);
$accId = $pgcred['faccid'];
define("RAZORPAY_KEY_ID", $pgcred['fkey']);
define("RAZORPAY_KEY_SECRET", $pgcred['fworkingid']);
require('config.php');
require('razorpay-php/Razorpay.php');
use Razorpay\Api\Api;
$api = new Api($keyId, $keySecret);
if($fheadcode == 'APPLICATION FEE'){
$fjoin = 'adm_lead st on st.fleadid = a.fleadid ';
$paymentType = "APPLICATION FEE";
$inttyp = 'fleadid';
}else{
$fjoin = 'adm_stud st on st.fappno';
$paymentType = "Seat Blocking Amount";
$inttyp = 'fappno';
}
$get_data = "select a.$inttyp as fappno, a.fdegree, ifnull(st.finst,'')as fcollcode,
a.fyear, ifnull(s.FAMOUNT, 0) as ftotalfee,
st.fname, control.funivname, pdf_logo_path, IFNULL(st.FMOBILE,'') as fmobileno,
IFNULL(st.FEMAIL,'') as femail from control, adm_studfee a
inner join adm_studfeesum s on s.$inttyp = a.$inttyp
inner join $fjoin
where s.$inttyp ='{$appno}'";
$result = $conn->query($get_data);
// var_dump($get_data,mysqli_num_rows($result));die();
if (mysqli_num_rows($result) > 0)
{
// output data of each row
while($row = mysqli_fetch_assoc($result))
{
$fregno = $row['fappno'];
$fdegree = $row['fdegree'];
$fcollcode = $row['fcollcode'];
$fyear = $row['fyear'];
$fexamtype = '1';
$ftotalfee = $row['ftotalfee'];
$fname = $row['fname'];
$fmobileno = $row['fmobileno'];
$femail = $row['femail'];
$funivname = $row['funivname'];
$logo = $row['pdf_logo_path'];
}
}
else {
echo "Some thing went wrong";
die();
}
$number = rand(10000001,99999999);
//
// We create an razorpay order using orders api
// Docs: https://docs.razorpay.com/docs/orders
//
$amount = $ftotalfee * 100;
$transfersArray = array("account" => $accId,
"amount" => $amount,
"currency" => "INR"
);
$transfersArrayN = array($transfersArray);
$orderData = [
'receipt' => $number,
'amount' => $amount, // 2000 rupees in paise
'currency' => 'INR',
'payment_capture' => 1, // auto capture
'transfers' => $transfersArrayN
];
//print_r($orderData);die();
$razorpayOrder = $api->order->create($orderData);
// $razorpayOrder = $api->order->create(array('receipt' => $number, 'payment_capture' => 1, 'amount' => $amount, 'currency' => 'INR', 'transfers' => array(array('account' => $accId, 'amount' => $amount, 'currency' => 'INR'))));
$razorpayOrderId = $razorpayOrder['id'];
$_SESSION['razorpay_order_id'] = $razorpayOrderId;
$displayAmount = $amount = $orderData['amount'];
$description = "";
$query = "update adm_studfeesum set forderid = '{$razorpayOrderId}', FPAYTYPE = 'Razorpay'
where fappno = '{$appno}'";
$result1 =$conn->query($query);
$query = "insert into pgdet(ftype, appno, fappdate, fpaygateway, fregno, fdegree, fcollcode, famount,
forderid, fyear, fexamtype, fcreatedate)
values('{$degree}', '{$appno}', current_date(), 'Razorpay', '{$fregno}', '{$fdegree}', '{$fcollcode}', '{$ftotalfee}',
'{$razorpayOrderId}', '{$fyear}', '{$fexamtype}', now())";
$result1 =$conn->query($query);
if ($displayCurrency !== 'INR')
{
$url = "https://api.fixer.io/latest?symbols=$displayCurrency&base=INR";
$exchange = json_decode(file_get_contents($url), true);
$displayAmount = $exchange['rates'][$displayCurrency] * $amount / 100;
}
$checkout = 'manual';
if (isset($_GET['checkout']) and in_array($_GET['checkout'], ['automatic', 'manual'], true))
{
$checkout = $_GET['checkout'];
}
$data = [
"key" => $keyId,
"amount" => $amount,
"name" => $funivname,
"description" => $description,
"notes" => [
"appno" => $appno,
"univcode" => $funivcode,
"regno" => $fregno,
"fheadcode" => $paymentType
],
"hidden"=> [
"Email" => true,
"Contact" => true
],
"theme" => [
"color" => "#F37254"
],
"order_id" => $razorpayOrderId,
"continue" => "http://192.168.0.32/verify.php?funivcode=023"
];
if ($displayCurrency !== 'INR')
{
$data['display_currency'] = $displayCurrency;
$data['display_amount'] = $displayAmount;
}
$json = json_encode($data);
require("checkout/{$checkout}.php");
|