Sindbad~EG File Manager

Current Path : /home/atdotid/public_html_old/buattoko/
Upload File :
Current File : /home/atdotid/public_html_old/buattoko/webhook.php

<?php

$token = '$2y$10$MPIMREBC/.jEpalxe/UVROls1qSHqbBkicjWsx3EFUb8WX26n7lOa';

$body = file_get_contents('php://input');
$data = json_decode($body, true);

$transaction = $data['midtrans']['status'];
$type = $data['midtrans']['type'];
$order_id = $data['midtrans']['order_id'];
$fraud = $data['midtrans']['fraud'];
$settlement_time = $data['midtrans']['settlement_time'];

try {
	$mysqli = new mysqli('localhost', 'buattoko_user', 'buattoko_20202021@@!!', 'b_registerlpdb');
	
    if ($mysqli->connect_errno) {
      die("Connect Error " . $mysqli->connect_errno );
    }
	$sql = "SELECT order_id FROM invoice_status WHERE order_id = '$order_id'";
	$res = $mysqli->query($sql);
	
	if ($res->num_rows > 0) {
		$sql = "UPDATE invoice_status set transaction='$transaction' WHERE order_id = '$order_id'";
		$mysqli->query($sql);
	} else {
		$created_at = date('Y-m-d H:i:s');
		$sql = "INSERT INTO invoice_status VALUES (null, '$order_id', '$type', '$transaction', '$fraud', '$settlement_time', '$created_at')";
	}
	print($sql);


	$mysqli->query($sql);
} catch (\Exception $e) {
	print_r($e->getMessage());
}

?>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists