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.133.141.201
<?php
require('config.php');
require('razorpay-php/Razorpay.php');
include("/var/www/config.php");
session_start();
// Create the Razorpay Order
use Razorpay\Api\Api;
$api = new Api($keyId, $keySecret);
$appno = $_POST['appno'];
if(isset($_POST['fregno']))
$fregno = $_POST['fregno'];
$funivcode = '033';
$servername = SERVERNAME;
$username = USERNAME;
$password = PASSWORD;
/*$servername = "localhost";
$username = "root";
$password = "";*/
$dbname = "logisys3_comexam";
$conn = new mysqli($servername, $username, $password, $dbname);
$get_data = "select * from dbname";
$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'];
}
}
mysqli_close($conn);
$servername = SERVERNAME;
$username = USERNAME;
$password = PASSWORD;
/*$servername = "localhost";
$username = "root";
$password = "";*/
$dbname = $dbnames[$funivcode];
$conn = new mysqli($servername, $username, $password, $dbname);
//IFNULL(cs.ftotalfee,0)
/*$get_data = "select cs.fregno, IFNULL(cs.ftotalfee,0) as ftotalfee, s.fname,control.funivname,pdf_logo_path,
IFNULL(s.fmobileno,'') as fmobileno,IFNULL(s.femail,'') as femail
from control, appcandsum cs
inner join student s on cs.fregno = s.fregno
where appno = '{$appno}'";
$result=$conn->query($get_data); */
//(IFNULL(cs.ftotfee,0))
if($fregno != '')
{
$get_data = "select cs.fregno as fregno, (IFNULL(cs.fregfee,0)) as ftotalfee,
control.funivname,pdf_logo_path, cs.fregno as fmobileno
,cs.fregno as fname,cs.fregno as femail
from control, regcandsum cs
inner join college c on cs.fcollcode = c.fcollcode
where fappno = '{$appno}'";
}else{
$get_data = "select cs.fcollcode as fregno, (IFNULL(cs.ftotfee,0)) as ftotalfee,
control.funivname,pdf_logo_path, cs.fcontact_no as fmobileno
,cs.fname as fname,cs.femail as femail
from control, studadm cs
inner join college c on cs.fcollcode = c.fcollcode
where fappno = '{$appno}'";
}
$result=$conn->query($get_data);
if (mysqli_num_rows($result) > 0)
{
// output data of each row
while($row = mysqli_fetch_assoc($result))
{
$fregno = $row['fregno'];
$ftotalfee = $row['ftotalfee'];
$fname = $row['fname'];
$fmobileno = $row['fmobileno'];
$femail = $row['femail'];
$funivname = $row['funivname'];
$logo = $row['pdf_logo_path'];
}
}
$number = rand(10000001,99999999);
//
// We create an razorpay order using orders api
// Docs: https://docs.razorpay.com/docs/orders
//$ftotalfee = 1;
//
$orderData = [
'receipt' => $number,
'amount' => $ftotalfee * 100, // 2000 rupees in paise
'currency' => 'INR',
'payment_capture' => 1 // auto capture
];
$razorpayOrder = $api->order->create($orderData);
$razorpayOrderId = $razorpayOrder['id'];
$_SESSION['razorpay_order_id'] = $razorpayOrderId;
$displayAmount = $amount = $orderData['amount'];
if($fregno != '')
{
$query = "update regcandsum set fpaymentorderid = '{$razorpayOrderId}'
where fappno = '{$appno}'";
}else
{
$query = "update studadm set fpaymentorderid = '{$razorpayOrderId}'
where fappno = '{$appno}'";
}
$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'];
}
//var_dump($checkout);die();
$data = [
"key" => $keyId,
"amount" => $amount,
"name" => $funivname,
"description" => "UG Admission Fee",
"image" => "http://studentportal.universitysolutions.in/gcg/img/logo.jpg",
"prefill" => [
"name" => $fname,
"email" => $femail,
"contact" => $fmobileno,
],
"notes" => [
"appno" => $appno,
"univcode" => $funivcode,
"regno" => $fregno
],
"theme" => [
"color" => "#F37254"
],
"order_id" => $razorpayOrderId,
];
if ($displayCurrency !== 'INR')
{
$data['display_currency'] = $displayCurrency;
$data['display_amount'] = $displayAmount;
}
$json = json_encode($data);
require("checkout/{$checkout}.php");
|