-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathjob.php
More file actions
88 lines (85 loc) · 4 KB
/
job.php
File metadata and controls
88 lines (85 loc) · 4 KB
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
<!--
Copyright (C) 2013 BitCoin Information (bitcoininformation.appspot.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<?php
include("includes/config.php");
try{
$json = file_get_contents("https://blockchain.info/nl/merchant/".GUID."/address_balance?password=".FIRSTPASSWORD."&address=".FAUCETADDRESS."&confirmations=".MINIMUMTRANSACTION."");
$data = json_decode($json);
if($data->{'balance'}/100000000 > 0.01){
include("includes/mysql.php");
$result = mysql_query("SELECT address FROM ".MYSQLBTCTABLE."") or die(mysql_error());
$currentpayrequests = 0;
while($row = mysql_fetch_array($result))
{
$currentpayrequests++;
}
if($currentpayrequests >= MINIMUMPAYOUTREQUEST){
$arr = null;
$result = mysql_query("SELECT address, pricewin FROM ".MYSQLBTCTABLE." ORDER BY id LIMIT 100 OFFSET 1") or die(mysql_error());;
if(mysql_fetch_array($result) != null){
$totalpricewins = 0;
while($row = mysql_fetch_array($result))
{
if($row['pricewin'] == "0"){
$arr[$row['address']] = FAUCETAMOUNTINSATOSHI;
}else{
$arr[$row['address']] = (FAUCETAMOUNTINSATOSHI * PRICEWINTIME);
$totalpricewins++;
}
}
$recipients = urlencode(json_encode($arr));
if($recipients == null || $recipients == ""){
echo "Problem with recipients";
}else{
if(($currentpayrequests * 1000) < 5430){
echo "Stopped by the 5430 Satoshi blockade. Your payment has to be higher then 5430 Satoshi.<br/>This can be done easily by increasing your reward or minimum payout in the config file.<br/>";
}else{
if(SECONDPASSWORD == ""){
echo "No second password<br />";
$json_url = "https://blockchain.info/nl/merchant/".GUID."/sendmany?password=".FIRSTPASSWORD."¬e=".NOTEMESSAGE."&recipients=$recipients";
}else{
$json_url = "https://blockchain.info/nl/merchant/".GUID."/sendmany?password=".FIRSTPASSWORD."&second_password=".SECONDPASSWORD."¬e=".NOTEMESSAGE."&recipients=$recipients";
}
$json_data = file_get_contents($json_url);
$json_feed = json_decode($json_data);
echo $json_feed->{'message'};
echo $json_feed->{'error'};
if($json_feed->{'error'} == null){
$result = mysql_query("SELECT payments, pricewins FROM ".MYSQLINFORMATIONTABLE." ORDER BY datetime DESC LIMIT 1");
while($row = mysql_fetch_array($result)){
//Update the faucet information
mysql_query("INSERT INTO ".MYSQLINFORMATIONTABLE." (id,datetime,payments,pricewins)VALUES (NULL,'".date("Y-m-d H:i:s")."', '". ($row['payments'] + 1)."', '". ($row['pricewins'] + $totalpricewins )."')");
}
mysql_query("DELETE FROM ".MYSQLBTCTABLE." WHERE id IN (select id from (select id FROM ".MYSQLBTCTABLE." ORDER BY id DESC LIMIT 100 OFFSET 1) x)");
// This is a know bug. The payout script doesn't work with the first row. That is why there is a OFFSET 1. This line is needed howewer. You can change it if you want. //
mysql_query("INSERT INTO ".MYSQLBTCTABLE." (id,address,ip) VALUES ('1', 'randomaddress', '127.0.0.1' )");
// ------------------------- //
echo "<br />Cleared table";
}
}
}
}else{
echo "Nobody to give BTC too.";
}
}else{
echo "Too few requests to cashout.";
}
mysql_close();
}else{
echo "Not enough BTC to payout.";
}
}catch (Exception $e) {
echo "Something went wrong.";
}
?>