The code for callback:
<?php
$id ="";
$pw = "";
$secret = "f8fe526080ec3366eddbb498c6df4e1a"; //md5 hash a unui cuvant
$address = "1MBF4cGmVac3r561YYRcamqJKN269yk7aD";
if($_GET['secret'] != $secret){
echo "Invalid";
return;
}
if($_GET['mainaddress'] != $address){
echo "Invalid";
return;
}
if (!isset($_GET['btc'])){
echo "Invalid";
return;
}
if (!isset($_GET['value'])){
echo "Invalid";
return;
}
$price = $_GET['btc'];
$value= $_GET['value'] / 10000000;
if ($price >= $value){
$email = "email@yahoo.com";
$subject = "Payment Received";
$body = "Payment received for invoice #". $_GET['invoice'] . "\r\n" . "Price: " . $price . " BTC" . "\r\n";
$headers = "From: GoBets <sales@gobets.pw>". "\r\n";
$headers .= "Content-type: text/html\r\n";
$mail = mail($email, $subject, $body, $headers);
}else{
$mail2 = mail($email, "rekt","hdhdhd",$headers);
}
if($mail){
echo "*ok*"; // return code pentru blockchain
}
if ($mail2){
echo "*ok*";
}
?>
The code to create address and set callback:
<?php
session_start();
$secret = "f8fe526080ec3366eddbb498c6df4e1a"; // md5 hash of a word
$address = "1MBF4cGmVac3r561YYRcamqJKN269yk7aD";
if ($_GET['test'] == true) {
echo 'Ignoring Test Callback';
return;
}
if (isset($_GET['key'])) {
if ($_GET['key'] == "p1") {
$price_in_usd = 1;
} elseif ($_GET['key'] == "p2") {
$price_in_usd = 4.5;
} elseif ($_GET['key'] == "p3") {
$price_in_usd = 8;
} elseif ($_GET['key'] == "p4") {
$price_in_usd = 15;
} elseif ($_GET['key'] == "test") {
$price_in_usd = 0.3;
} else {
echo "Invalid param. Please contact an administrator or try again later";
return;
}
if (!empty($price_in_usd)) {
// Simulate BTC conversion and QR code generation since actual URLs are removed
$price_in_btc = $price_in_usd * 0.000025; // Example fixed conversion rate
$invoice = $_SESSION['s_ID'] . "-" . rand();
$input_address = "simulatedBTCAddress123"; // Simulated BTC address
$qrcode_data = "bitcoin:" . $input_address . "?amount=" . $price_in_btc;
echo '<div align="center">';
echo '<div>[QR CODE IMAGE HERE]</div>'; // Placeholder for QR code
echo "Invoice #: " . $invoice . "<br>";
echo "Please send <b>" . $price_in_btc . "</b> BTC to <b>" . $input_address . "</b><br>";
echo "</div>";
}
} else {
echo "Something went wrong!";
}
?>
This is not working. Need help.