| Server IP : 172.64.80.1 / Your IP : 172.70.50.62 Web Server : Apache System : Linux mail.federalpolyede.edu.ng 5.10.0-32-amd64 #1 SMP Debian 5.10.223-1 (2024-08-10) x86_64 User : federalpolyede.edu.ng_idh35skikv ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/federalpolyede.edu.ng/httpdocs_backup/ace_admin_student/ |
Upload File : |
<?php
session_start();
$result = array();
$refNo=$_GET['refNo'];
//The parameter after verify/ is the transaction reference to be verified
$url = 'https://api.paystack.co/transaction/verify/'.$refNo;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt(
$ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer sk_test_36658e3260b1d1668b563e6d8268e46ad6da3273']
);
$request = curl_exec($ch);
curl_close($ch);
if ($request) {
$result = json_decode($request, true);
// print_r($result);
// die();
if($result){
$response_code= ($result['status']);
$orderID=$reference=$refNo;
// die();
$msg=$result->message;
$result->data->created_at;
// print_r($result);
// echo $result['data']['status'];
echo $msg=$result['message'];
$trans_num= $result['data']['id'];
$amt=$result['data']['amount']/100;
//
// $status_desc=$result['data']['gateway_response'];
$transDate=$result['data']['paid_at'];
if($result['data']['status'] == 'success') {
$transApproved = 'True';
}else{
$transApproved = 'False';
}
$transCreated=$result['data']['created_at'];
require_once('../connect.php');
$db=db_connect();
require('../filetoU/logFile.php');
// $orderID=$transid;
$descr=$_GET['ttype'];
echo $matNo=$_SESSION['matNo'];
// die($descr);
$logD='Payment. OrderID: '.$orderID.' PaymentType: '.$reference;
logDetail($matNo,$logD);
$ade="UPDATE `fedpoly`.`ace_remitaorder` SET `remitaRRR` = '$trans_num',`transDate` = '$transDate',`transStatus` = '$response_code',`transDetail` = '$msg',`transApproved` ='$transApproved' WHERE `ace_remitaorder`.`orderID` ='$refNo'";
$db->query($ade);
// die($ade);
if($result['data']){
//something came in
if($result['data']['status'] == 'success'){
// the transaction was successful, you can deliver value
/*
@ also remember that if this was a card transaction, you can store the
@ card authorization to enable you charge the customer subsequently.
@ The card authorization is in:
@ $result['data']['authorization']['authorization_code'];
@ PS: Store the authorization with this email address used for this transaction.
@ The authorization will only work with this particular email.
@ If the user changes his email on your system, it will be unusable
*/
// echo "Transaction was successful";
//=====================Acceptance fees ======================================
if (($descr == 'Acceptance Fee')) {
// echo '<a href="print/acceptancePrint.php" target="_blank">Click Here to Print Acceptance Receipt</a>';
// echo '<br><a href="print/admissionLetter.php" target="_blank">Print Admission Letter</a>';
$k = $db->query("select * from ace_remitaorder where regNo='$matNo'and paymentType='Acceptance Fee' and transApproved='True'")->rowCount();
if ($k > 0) {
$cardGet1 = $db->query("select * from stddata where formNo='$matNo' or jambNo='$matNo'");
$cardGet1_fetch = $cardGet1->fetch(PDO::FETCH_BOTH);
$cardGet1_num = $cardGet1->rowCount();
if ($cardGet1->rowCount() > 0) {
$admittedGet = $db->query("select * from ace_admitted where formNo='$matNo'");
$admittedGet_fetch = $admittedGet->fetch(PDO::FETCH_BOTH);
if ($admittedGet->rowCount() > 0) {
$cardGet1_fetch['formNo'] . '==>';
$names = $cardGet1_fetch['surname'] . ' ' . $cardGet1_fetch['otherNames'];
$names = str_replace("'", "''", $names);
$course = $admittedGet_fetch['course'];
$levelID = $admittedGet_fetch['levelID'];
$address = $cardGet1_fetch['address'];
$address = str_replace("'", "''", $address);
$state = $cardGet1_fetch['state'];
$lga = $cardGet1_fetch['lga'];
$email = $cardGet1_fetch['email'];
$gsm = $cardGet1_fetch['gsm'];
$ausername = $admittedGet_fetch['formNo'];
$apassword = $admittedGet_fetch['formNo'];
$mode = $admittedGet_fetch['mode'];
$dob = $cardGet1_fetch['dob'];
$sex = $cardGet1_fetch['sex'];
$hh = $db->query("INSERT INTO `fedpoly`.`ace_realdata` (`sn`, `formNo`, `matNo`, `names`, `course`, `levelID`, `mode`, `state`, `lga`, `dob`, `gsm`, `sex`, `address`, `email`, `usernamea`, `passworda`, `fresher`) VALUES (NULL, '$matNo', '$matNo', '$names', '$course', '$levelID', '$mode', '$state', '$lga', '$dob', '$gsm', '$sex', '$address', '$email', '$matNo', '$matNo', '4')");
}
}
}
}
//=======================End Acceptance =====================================
//echo $reference;
if (($descr == 'School Fees')) {
// die($t);
// echo '<a href="print/schoolFeePrint.php" target="_blank">Click to Print School Receipt</a>';
// echo '<br><a href="admin.php" target="_blank">Continue Registration</a>';
//===============================================*****************************
$mSQL = "select * from ace_realdata where formNo='$matNo' and matNo='$matNo' and fresher=4";
$mResult = $db->query($mSQL);
$mNum = $mResult->rowCount();
// die($mNum);
if ($mNum > 0) {
$matNoOld = $_SESSION['formNo'];
//generate prefix and sufix
$deptID = $_SESSION['deptID'];
$levelID = $_SESSION['levelID'];
// echo $_SESSION['course'] ;
$prefixQ = $db->query("select * from dept where sn='$deptID'");
$prefixQ_fetch = $prefixQ->fetch(PDO::FETCH_BOTH);
$numPrefix = $prefixQ->rowCount();
$courseName = $prefixQ_fetch['dOption'];
if ($numPrefix > 0) {
if ($levelID == '1') {
$prefix = $prefixQ_fetch['nd'];
$sufix = '';
$levelCode = '01';
} elseif ($levelID == '3') {
$prefix = $prefixQ_fetch['hnd'];
$sufix = '';
$levelCode = '01';
} elseif ($levelID == '5') {
$prefix = $prefixQ_fetch['nd'];
$sufix = 'PT';
$levelCode = '03';
} elseif ($levelID == '8') {
$prefix = $prefixQ_fetch['nd'];
$sufix = 'DPT';
$levelCode = '02';
} elseif ($levelID == '10') {
$prefix = $prefixQ_fetch['nd'];
$sufix = '';
$levelCode = '01';
} elseif ($levelID == '11') {
$prefix = $prefixQ_fetch['hnd'];
$sufix = '';
$levelCode = '02';
}
}
//End of prefix and sufix
//generate serial Number
// echo $courseName;
//$matSQL="select * from realdata where fresher='20' and course='$courseName' and levelID='$levelID' ";
$matSQL = "select * from ace_realdata where fresher='40' ";
$matResult = $db->query($matSQL);
$matNum = $matResult->rowCount();
if ($matNum > 0) {
$realNo = $matNum + 1;
if ($realNo < 10) {
$serialNo = '2018' . $levelCode . '0000' . $realNo;
} elseif ($realNo < 100) {
$serialNo = '2018' . $levelCode . '000' . $realNo;
} elseif ($realNo < 1000) {
$serialNo = '2018' . $levelCode . '00' . $realNo;
} elseif ($realNo < 10000) {
$serialNo = '2018' . $levelCode . '0' . $realNo;
} else {
$serialNo = '2018' . $levelCode . $realNo;
}
} else {
$serialNo = '2018' . $levelCode . '00001';
}
$newMatNo = 'ACE' . $prefix . $serialNo;
$real="UPDATE `fedpoly`.`ace_realdata` SET `matNo` = '$newMatNo',`usernamea` = '$newMatNo',`passworda` = '$newMatNo',`fresher` = '40' WHERE `ace_realdata`.`formNo` ='$matNo'";
$db->query($real);
$real2="UPDATE `fedpoly`.`ace_remitaorder` SET `regNo` = '$newMatNo' WHERE `ace_remitaorder`.`orderID` ='$orderID'";
$db->query($real2);
$_SESSION['matNo'] = $newMatNo;
// copy('../passportForm/' . $matNo . '.jpg', 'passport/Reg' . $newMatNo . '.jpg');
// echo '<font color="#FF0000"><h2><br> Note: Your Username and Password is now ' . $newMatNo . '</h2></font>';
}
}
}else{
// the transaction was not successful, do not deliver value'
// print_r($result); //uncomment this line to inspect the result, to check why it failed.
echo "Transaction was not successful: Last gateway response was: ".$result['data']['gateway_response'];
}
}else{
echo $result['message'];
}
}else{
//print_r($result);
die("Something went wrong while trying to convert the request variable to json. Uncomment the print_r command to see what is in the result variable.");
}
}else{
//var_dump($request);
die("Something went wrong while executing curl. Uncomment the var_dump line above this line to see what the issue is. Please check your CURL command to make sure everything is ok");
}
header('location:'.'ps_paymentHistory.php');