One Hat Cyber Team
Your IP :
216.73.216.186
Server IP :
91.108.106.74
Server :
Linux in-mum-web1837.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
u322583024
/
domains
/
awaha.in
/
public_html
/
Edit File:
update-order-status.php
<?php session_name('vaishnavi_awaha'); session_start(); require_once 'connect.inc.php'; // Enable error logging ini_set('log_errors', 1); ini_set('error_log', __DIR__ . '/error_log.txt'); ini_set('display_errors', 0); // Optional: Disable error display in production error_reporting(E_ALL); // Log all types of errors // Set the response header header('Content-Type: application/json'); // Get the input data from the request body $request_body = file_get_contents('php://input'); $data = json_decode($request_body, true); // Check if the required data is provided if (!isset($data['order_id'], $data['payment_id'], $data['payment_status'])) { echo json_encode(['success' => false, 'message' => 'Missing required data.']); exit; } $order_id = $data['order_id']; $payment_id = $data['payment_id']; $payment_status = $data['payment_status']; // Assuming you have a user session and user_id is available $user_id = $_SESSION['user_id'] ?? null; // Ensure session is active if (!$user_id) { echo json_encode(['success' => false, 'message' => 'User not logged in.']); exit; } try { // Start a transaction $pdo->beginTransaction(); // Update the order status in the database $stmt = $pdo->prepare("UPDATE orders SET razorpay_payment_id = ?, payment_done_on = NOW() WHERE order_id = ? AND user_id = ?"); $stmt->execute([$payment_id, $order_id, $user_id]); // If the update is successful, commit the transaction $pdo->commit(); echo json_encode(['success' => true, 'order_id' => $order_id]); } catch (PDOException $e) { // Rollback transaction on error $pdo->rollBack(); error_log('Database error: ' . $e->getMessage()); echo json_encode(['success' => false, 'message' => 'Database error: ' . $e->getMessage()]); } catch (Exception $e) { // General error handling $pdo->rollBack(); error_log('Error: ' . $e->getMessage()); echo json_encode(['success' => false, 'message' => 'Error: ' . $e->getMessage()]); } ?>
Simpan