| 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/admin_student/ |
Upload File : |
<?php
require_once('connect.php');
$db = db_connect();
$regNo='URL';
$logDetail='reQuery_student';
require('../filetoU/logFile.php');
require 'remita_constants2.php';
$queryResult=$db->query("select * from remitaorder where transApproved='False' and paymentType='School Fees' order by sn desc limit 0,100");
$queryNum=$queryResult->rowCount();
$i=0;
//while ($i< $queryNum){
while ($row=$queryResult->fetch(PDO::FETCH_BOTH)) {
$orderId = $row['orderID'];
$response_code = "";
$rrr = "";
$response_message = "";
$paymentType = $row['paymentType'];
$regNo = $row['regNo'];
$transactiontime = "0";
$RRR = "0";
// get response from remita function
if ($orderId != null) {
$response = remita_transaction_details($orderId);
$response_code = $response['status'];
if (isset($response['RRR'])) {
$rrr = $response['RRR'];
}
$response_message = $response['message'];
$transactiontime = $response['transactiontime'];
$RRR = $response['RRR'];
$status = $response['status'];
$message = $response['message'];
//echo $response['Approved'];
if (($status == '00') or ($status == '01')) {
$transA = 'True';
echo 'am here';
echo '<font color="#FF0000"><h2><br> Note: (' . $paymentType . ') Registration No: ' . $regNo . '<br>RRR No: ' . $RRR . ' Status: ' . $transA . '</h2></font><br>';
// $db->query("UPDATE `fedpoly`.`remitaorder` SET `remitaRRR` = '$RRR',`transDate` = '$transactiontime',`transStatus` = '$status',`transDetail` = '$message',`transApproved` = '$transA' WHERE `remitaorder`.`orderID` ='$orderId'");
$princess= $db->prepare("UPDATE `fedpoly`.`remitaorder` SET `remitaRRR` = ?,`transDate` = ?,`transStatus` = ?,`transDetail` = ?,`transApproved` =? WHERE `remitaorder`.`orderID` =?");
$princess->execute([$remitaRRR,$transDate,$transStatus,$transDetail,$transApproved,$orderID]);
} else {
$transA = 'False';
}
// $logD = 'Requerying. OrderID: ' . $orderID . ' RRR: ' . $RRR;
// logDetail($regNo, $logD);
//----------------------------------------------------------------------
if (($paymentType == 'School Fees') and ($transA == 'True')) {
$mSQL = "select * from realdata where formNo='$regNo' and matNo='$regNo' and fresher='6'";
$mResult = $db->query($mSQL);
$mNum = $mResult->rowCount();
if ($mNum == 1) {
//Generating Suffix and Prefix
$mResult_fetch = $mResult->fetch(PDO::FETCH_BOTH);
$dept = $mResult_fetch['course'];
$name = $mResult_fetch['names'];
$levelID = $mResult_fetch['levelID'];
$prefixQ = $db->query("select * from dept where dOption='$dept'");
$prefixQ_fetch = $prefixQ->fetch(PDO::FETCH_BOTH);
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
$matSQL = "select * from realdata where fresher='60'";
$matResult = $db->query($matSQL);
$matNum = $matResult->rowCount();
if ($matNum > 0) {
$realNo = $matNum + 1;
if ($realNo < 10) {
$serialNo = '2020'.$levelCode.'0000' . $realNo;
} elseif ($realNo < 100) {
$serialNo = '2020'.$levelCode.'000' . $realNo;
} elseif ($realNo < 1000) {
$serialNo = '2020'.$levelCode.'00' . $realNo;
} elseif ($realNo < 10000) {
$serialNo = '2020'.$levelCode.'0' . $realNo;
} else {
$serialNo = '2020'.$levelCode . $realNo;
}
}else{
$serialNo = '2020'.$levelCode.'00001';
}
$newMatNo=$prefix.$serialNo;
$db->query("UPDATE `fedpoly`.`realdata` SET `matNo` = '$newMatNo',`usernamea` = '$newMatNo',`passworda` = '$newMatNo',`fresher` = '60' WHERE `realdata`.`formNo` ='$regNo'");
// $db->query("UPDATE `fedpoly`.`remitaorder` SET `regNo` = '$newMatNo' WHERE `remitaorder`.`orderID` ='$orderId'");
$kk=$db->prepare("UPDATE `fedpoly`.`remitaorder` SET `regNo` = ? WHERE `remitaorder`.`orderID` =?");
$kk->execute([$newMatNo,$orderID]);
// $_SESSION['matNo'] = $newMatNo;
} else {
echo '<font color="#FF0000"><h2><br> Note: Your Name: '.$name.' Username and Password is now ' . $newMatNo .' Status: '.$transA. '</h2></font>';
//end of generating serial number
if (($transA == 'True') and ($paymentType == 'Acceptance Fee')) {
$k = ($db->query("select * from remitaorder where regNo='$regNo'and paymentType='Acceptance Fee' and transApproved='True'")->rowCount());
if ($k>0) {
$cardGet = $db->query("select * from stddata where formNo='$regNo' or jambNo='$regNo'");
$cardGet_fetch = $cardGet->fetch(PDO::FETCH_BOTH);
if ($numGet = $cardGet->rowCount() > 0) {
$admittedGet = $db->query("select * from admitted where formNo='$regNo'");
$admittedGet_fetch = $admittedGet->fetch(PDO::FETCH_BOTH);
if ($admittedGet->rowCount() > 0) {
$names = $cardGet_fetch['surname'] . ' ' . $cardGet_fetch['otherNames'];
$names = str_replace("'", "''", $names);
$course = $admittedGet_fetch['course'];
$levelID = $admittedGet_fetch['levelID'];
$address = $cardGet_fetch['address'];
$state = $cardGet_fetch['state'];
$lga = $cardGet_fetch['lga'];
$email = $cardGet_fetch['email'];
$gsm = $cardGet_fetch['gsm'];
$ausername = $admittedGet_fetch['formNo'];
$apassword = $admittedGet_fetch['formNo'];
$mode = $admittedGet_fetch['mode'];
$dob = $cardGet_fetch['dob'];
$sex = $cardGet_fetch['sex'];
$db->query("INSERT INTO `fedpoly`.`realdata`
(`sn`, `formNo`, `matNo`, `names`, `course`, `levelID`, `mode`, `state`, `lga`, `dob`, `gsm`, `sex`, `address`, `email`, `usernamea`, `passworda`, `fresher`) VALUES
(NULL, '$regNo', '$regNo', '$names', '$course', '$levelID', '$mode', '$state', '$lga', '$dob', '$gsm', '$sex', '$address', '$email', '$regNo', '$regNo', 6)");
}
}
}
// echo '<font color="#FF0000"><h2><br> Note: (Acceptance Fees)Your Name: '.$names.' Registration No: ' . $regNo .'<br>RRR No: '.$RRR.' Status: '.$transA. '</h2></font><br>';
}
}
}
}
}
//Verify Transaction
function remita_transaction_details($orderId){
$mert = MERCHANTID;
$api_key = APIKEY;
$concatString = $orderId . $api_key . $mert;
$hash = hash('sha512', $concatString);
$url =trim(CHECKSTATUSURL . '/' . $mert . '/' . $orderId . '/' . $hash . '/' . 'orderstatus.reg');
// Initiate curl
$ch = curl_init();
// Disable SSL verification
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// Will return the response, if false it print the response
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
curl_setopt($ch, CURLOPT_URL,$url);
// Execute
$result=curl_exec($ch);
// Closing
curl_close($ch);
$result;
$response = json_decode($result, true);
return $response;
}
?>