Added options to enable/disable account upgrades and coinpayments

This commit is contained in:
Daniel Winzen
2020-01-11 13:18:50 +01:00
parent a69714bce8
commit 5abb32402d
5 changed files with 15 additions and 8 deletions

View File

@ -1,29 +1,30 @@
<?php
require('../common.php');
if(!ENABLE_UPGRADES){
die('Upgrades disabled');
}
if(!COINPAYMENTS_ENABLED){
die('CoinPayments disabled');
}
if(empty($_SERVER['HTTP_HMAC'])){
die("No HMAC signature sent");
}
$merchant = $_POST['merchant'] ?? '';
if(empty($merchant)){
die("No Merchant ID passed");
}
if($merchant !== COINPAYMENTS_MERCHANT_ID){
die("Invalid Merchant ID");
}
$request = file_get_contents('php://input');
if(empty($request)){
die("Error reading POST data");
}
$hmac = hash_hmac("sha512", $request, COINPAYMENTS_IPN_SECRET);
if($hmac !== $_SERVER['HTTP_HMAC']){
die("HMAC signature does not match");
}
$db = get_db_instance();
$status = 0;
if($_POST['status'] < 0){