Mini Shell
<?php
die("die success");
$merchant_id = $_POST['merchant_id'];
$studentprimary_id = $_POST['studentpri_id'];
$order_id = $_POST['order_id'];
$payhere_amount = $_POST['payhere_amount'];
$payhere_currency = $_POST['payhere_currency'];
$status_code = $_POST['status_code'];
$md5sig = $_POST['md5sig'];
$merchant_secret = '4eSlYxQLqJr4OdiB8o1v684OXFyM8xEW58QqAcl6ZhVU'; // Replace with your Merchant Secret (Can be found on your PayHere account's Settings page)
$local_md5sig = strtoupper (md5 ( $merchant_id . $order_id . $payhere_amount . $payhere_currency . $status_code . strtoupper(md5($merchant_secret)) ) );
if (($local_md5sig === $md5sig) AND ($status_code == 2) ){
//TODO: Update your database as payment success
$servername = "localhost";
$username = "rizant5_root";
$password = "lva@4rizan";
$dbname = "rizant5_lanka";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO payments (stu_id, txnid, payment_amount, payment_status, createdtime, error_log)
VALUES ('$studentprimary_id', '$order_id', '123', 'success', 'sample date', 'thisis sample')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
?>
Zerion Mini Shell 1.0