-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathfunctions.php
100 lines (95 loc) · 4.37 KB
/
functions.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
// Sotoshisize bitcoin amounts and then trim them clean.
function satoshisize($satoshitize) {
return rtrim(rtrim(sprintf("%.8f", $satoshitize), "0"), ".");
}
$SESSION_ADMIN = $_SESSION['SESSION_ADMIN'];
$dbconn = mysql_connect($DB_LOCATION,$DB_USERNAME,$DB_PASSWORD);
if(!$dbconn) { die($DB_ERROR); }
$dbc = mysql_select_db($DB_NAME);
if(!$dbc) { die($DB_ERROR); }
$Query = mysql_query("SELECT paid FROM requests WHERE paid='0'");
$FAUCET_PEND = mysql_num_rows($Query);
$Query = mysql_query("SELECT paid FROM requests");
$FAUCET_PAID = mysql_num_rows($Query);
$Query = mysql_query("SELECT * FROM settings WHERE id='1'");
while($Row = mysql_fetch_assoc($Query)) {
$ADMIN_USERNAME = $Row['username'];
$ADMIN_PASSWORD = $Row['password'];
$WEBSITE_NAME = $Row['faucet_title'];
$WEBSITE_URL = $Row['faucet_url'];
$TX_DISPLAY_LIMIT = $Row['tx_display_limit'];
$FAUCET_AMOUNT = $Row['faucet_amount'];
$FAUCET_REQUEST_EVERY = $Row['pay_every'];
$BLOCKCHAIN_GUID = $Row['blockchain_guid'];
$BLOCKCHAIN_FIRST = $Row['blockchain_first'];
$BLOCKCHAIN_SECOND = $Row['blockchain_second'];
$BLOCKCHAIN_FROM = $Row['blockchain_keyaddress'];
$yocaptcha_status = $Row['yocaptcha_status'];
$yocaptcha_public = $Row['yocaptcha_public'];
$yocaptcha_private = $Row['yocaptcha_private'];
}
$TXID_DISPLAY_LIST ='<table style="width: 500px;">
<tr>
<td align="left mstyle="padding: 5px;"><b>Last '.$TX_DISPLAY_LIMIT.' Transactions:</b></td>
</tr>';
$Query = mysql_query("SELECT txid FROM transactions");
if(mysql_num_rows($Query)!=0) {
$Query = mysql_query("SELECT date, txid FROM transactions ORDER BY id DESC LIMIT $TX_DISPLAY_LIMIT");
while($Row = mysql_fetch_assoc($Query)) {
$TXID_DISPLAY_LIST_DATE = $Row['date'];
$TXID_DISPLAY_LIST_TXID = $Row['txid'];
$TXID_DISPLAY_LIST .= '<tr>
<td align="left" style="padding: 5px; padding-left: 25px;">'.$TXID_DISPLAY_LIST_TXID.'</td>
</tr>';
}
} else {
$TXID_DISPLAY_LIST .= '<tr>
<td align="left" style="padding: 5px; padding-left: 25px;">Empty...</td>
</tr>';
}
$TXID_DISPLAY_LIST .= '</table>';
$FAUCET_WALLET_LABEL = "FaucetAddress"; // NO SPACES
if($BLOCKCHAIN_GUID) {
if($BLOCKCHAIN_FIRST) {
if($BLOCKCHAIN_SECOND) {
if(!$BLOCKCHAIN_FROM) {
$blockchain_api = "https://blockchain.info/merchant/$BLOCKCHAIN_GUID/new_address?password=$BLOCKCHAIN_FIRST&second_password=$BLOCKCHAIN_SECOND&label=$FAUCET_WALLET_LABEL";
$blockchain_response = file_get_contents($blockchain_api);
$blockchain_object = json_decode($blockchain_response);
$BLOCKCHAIN_FROM = $blockchain_object->address;
if(!$BLOCKCHAIN_FROM) {
$FAUCET_BALANCE = "?";
$SERER_CONNECTION = "Down";
} else {
$sql = mysql_query("UPDATE settings SET blockchain_keyaddress='$BLOCKCHAIN_FROM' WHERE id='1'");
$blockchain_api = "https://blockchain.info/merchant/$BLOCKCHAIN_GUID/address_balance?password=$BLOCKCHAIN_FIRST&address=$BLOCKCHAIN_FROM&confirmations=0";
$blockchain_response = file_get_contents($blockchain_api);
$blockchain_object = json_decode($blockchain_response);
$FAUCET_BALANCE = $blockchain_object->balance;
$FAUCET_BALANCE = $FAUCET_BALANCE / "100000000";
$FAUCET_BALANCE = satoshisize($FAUCET_BALANCE);
$SERER_CONNECTION = "Active";
}
} else {
$blockchain_api = "https://blockchain.info/merchant/$BLOCKCHAIN_GUID/address_balance?password=$BLOCKCHAIN_FIRST&address=$BLOCKCHAIN_FROM&confirmations=0";
$blockchain_response = file_get_contents($blockchain_api);
$blockchain_object = json_decode($blockchain_response);
$FAUCET_BALANCE = $blockchain_object->balance;
$FAUCET_BALANCE = $FAUCET_BALANCE / "100000000";
$FAUCET_BALANCE = satoshisize($FAUCET_BALANCE);
$SERER_CONNECTION = "Active";
}
} else {
$FAUCET_BALANCE = "?";
$SERER_CONNECTION = "Down";
}
} else {
$FAUCET_BALANCE = "?";
$SERER_CONNECTION = "Down";
}
} else {
$FAUCET_BALANCE = "?";
$SERER_CONNECTION = "Down";
}
?>