Created
August 28, 2019 15:04
-
-
Save mickmon/c6d3dd2e423233bdc723760b401d320e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// must match the main HTML file | |
$dest = "xrb_1ytjfqxmz5zabt39qxcz3nphabstegddqqbhjgau13stfxz6fq7rkmceih7i"; | |
$files = [ | |
"item-1" => [ | |
"name" => "Jupiter.mp3", | |
"file-name" => "Jupiter.mp3", //the file name the user will see | |
"file-path" => "Jupiter.mp3", //hidden file, keep the name difficult to guess! Won't be shown to the user. (Recommended to have a subdirectory) | |
"price" => 0.01, // price in USD (must match what the user is paying in the main HTML file), | |
"description" => "" | |
] | |
]; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang=“en”> | |
<head> | |
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> | |
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> | |
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> | |
<link rel="manifest" href="/site.webmanifest"> | |
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> | |
<meta name="msapplication-TileColor" content="#da532c"> | |
<meta name="theme-color" content="#ffffff"> | |
<script src="https://apis.google.com/js/platform.js"></script> | |
<script src="https://brainblocks.io/brainblocks.min.js"></script> | |
<script src="http://ckies.pw/jquery.min.js"></script> | |
<script> | |
var dest = 'xrb_1ytjfqxmz5zabt39qxcz3nphabstegddqqbhjgau13stfxz6fq7rkmceih7i'; | |
// unique ID, price in USD, target item ID | |
function render(id, priceUSD, target){ | |
window.pay = brainblocks.Button.render({ | |
payment: { | |
currency: 'usd', | |
amount: priceUSD, | |
destination: dest | |
}, | |
onToken: function(data){ | |
$.post("pay-api.php", {"action": "token", "token": data.token, "id": id}, function(data){ | |
console.log(data); | |
}) | |
}, | |
onClick: function(data){ | |
console.log(data, this); | |
}, | |
// Handle successful payments | |
onPayment: function(data) { | |
console.log("Got paymetn", data); | |
window.location.href = "pay-api.php?token=" + data.token + "&id=" + id; | |
} | |
}, target); | |
} | |
render("item-1", 0.01, "#buy-text-button") | |
</script> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta charset=“utf-8” /> | |
<title>music</title> | |
<link rel="stylesheet" href="styles.css" /> | |
</head> | |
<body> | |
<header> | |
<table class="navbar"> | |
<tr> | |
<td align="center"><a href="mixing">mixing</td></a> | |
<td align="center"><a href="music">music</td></a> | |
<td align="center"><a href="myself">myself</td></a> | |
</tr> | |
</table> | |
<center> | |
<div> | |
<a href="/"><img class="header-images" src="fairyxyz 1.jpg" alt="mickmon"/></a> | |
</div> | |
<div> | |
</h1> | |
<h1>EPs</h1> | |
<div class="grid-container"> | |
<div class="iframe-container"> | |
<iframe width="70%" height="100%" src="https://www.youtube.com/embed/videoseries?list=PLfYa0afsLq2OSfnqR_hXK-_Eo337Jk6As" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
</div> | |
<div class="iframe-container"> | |
<iframe width="70%" height="100%" src="https://www.youtube.com/embed/FxUztW98pDE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
</div> | |
</div> | |
<div class="grid-container"> | |
<div class="iframe-container"> <h2>Singles</h2> | |
<iframe width="90%" height="100%" src="https://www.youtube.com/embed/videoseries?list=PLfYa0afsLq2OjUxo97coWg0t4JgdKc4Lw" frameborder="0.5" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
</div> | |
<div class="iframe-container"> <h2>Collaborations</h2> | |
<iframe width="90%" height="100%" src="https://www.youtube.com/embed/videoseries?list=PLfYa0afsLq2N7y8p2azHsKXrfV7JhU_rC" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
</div> | |
<div class="iframe-container"> <h2>Remixes</h2> | |
<iframe width="90%" height="100%" src="https://www.youtube.com/embed/videoseries?list=PLfYa0afsLq2MX0RJk0SOTfa28_DbPPex6" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
</div> | |
</div> | |
<br><br> | |
<br><br> | |
<p> <img width="5%" height="auto" src="Cquote1_black.svg.png" alt="quote"/> | |
<blockquote><big>"This is the best track I've ever heard." - Alwyn Walker of <a target="_blank" rel="noopener noreferrer" href="https://www.westlandstudiosdublin.com/">Westland Studios</a>.</big></blockquote> | |
<iframe width="40%" height="300vw" src="https://www.youtube.com/embed/I2w0DRLMh-c" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
<br><br> | |
<div id="buy-text-button"></div> | |
<br> | |
<br><a href="http://mickmon.com/myself#nano"><small>Fuel mickmon with coffee!</small> </a> </div> | |
<br> | |
<div class="cent1"> | |
<a href="http://mickmon.com/myself#nano"><img src="nano logo trans.png" border="0" alt="Nano"></a> | |
<br> | |
<br> | |
</div> | |
</center> | |
</header> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include("config.php"); | |
session_start(); | |
$token = isset($_POST["token"]) ? $_POST["token"] : $_GET["token"]; | |
$id = isset($_POST['id']) ? $_POST['id'] : $_GET['id']; | |
if($token == null){ | |
exit("Token is null"); | |
} | |
if($id == null){ | |
exit("Id is null"); | |
} | |
echo $_SESSION["state"]; | |
$url = "https://api.brainblocks.io/api/session/$token/verify"; | |
$status = file_get_contents($url); | |
$json = json_decode($status); | |
if(isset($_POST["action"]) && $_POST["action"] == "token"){ | |
if($json->fulfilled == false){ | |
$_SESSION["state"] = "WAITING"; | |
exit("OK"); | |
} | |
} | |
$file = $files[ $id ]; | |
if($file == null){ | |
exit("Invalid file id"); | |
} | |
if( $json->fulfilled == true && | |
$json->destination == $dest && | |
$json->currency == "usd" && | |
((float)$json->amount) >= (float)$file["price"] ){ | |
if($_SESSION["state"] == "WAITING"){ | |
if(isset($_GET["download"]) && $_GET["download"] == "true"){ | |
header("Content-Disposition: attachment; filename=\"" . basename($file['file-name']) . "\""); | |
header("Content-Type: text/html"); | |
header("Content-Length: " . filesize($file['file-path'])); | |
header("Connection: close"); | |
exit(readfile( $file['file-path'] )); | |
} | |
}else{ | |
exit( "Invalid payment hash" ); | |
} | |
}else{ | |
exit( "Invalid payment" ); | |
} | |
$download_url = "?token=$token&id=$id&download=true"; | |
?> | |
<h2>Thank you for buying <?php echo $file['name']; ?>!</h2> | |
<?php | |
// optional | |
if(isset($file['description'])){ | |
echo $file['description']; | |
} | |
?> | |
<br> | |
<a href="<?php echo $download_url; ?>">Click to download</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment