-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.php
42 lines (30 loc) · 1.3 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
require_once("./lib/Stripe.php");
require_once("api.php");
$transfers = Stripe_Transfer::all();
$data = $transfers->data;
$stripebackers = 0;
$stripe = 0;
foreach($data as $each) {
$stripe += ($each["amount"]/100);
$stripebackers++;
}
$btc_refunds = 1;
$btc_refunds_amount = 1.00103456;
$number_of_payments = 2; //number of payments made, needs to be subtracted from the total backers
$json = file_get_contents("http://blockchain.info/address/1LQGG3P73ioV2e9jo8uzyCjnEJYxYpkUMR?format=json");
$data = json_decode($json, TRUE);
$backers = (($data["n_tx"]-($btc_refunds*2))-$number_of_payments) + $stripebackers;
$btc = $data["total_received"];
$btc_final = $btc/100000000;
$btc_final -= $btc_refunds_amount;
$goal = 3500;
$ratejson = file_get_contents("http://blockchain.info/ticker");
$ratedata = json_decode($ratejson, TRUE);
$rate = $ratedata["USD"]["15m"];
$total = number_format((float)(($btc_final*$rate)+$stripe), 2, ".", "");
$percent = ($total/$goal)*100;
$btc = number_format((float)($btc_final*$rate), 2, ".", "");
$percent_btc = $btc/($stripe+$btc)*100;
$percent_str = $stripe/($stripe+$btc)*100;
?>