-
Notifications
You must be signed in to change notification settings - Fork 11
/
submitted.php
96 lines (86 loc) · 3.61 KB
/
submitted.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
<?php
/**
* @author Greedi
* @copyright 2012
* @author Subcreative
* @copyright 2014
*/
error_reporting(E_ALL);
include ('core/banned.php');
include_once ("core/wallet.php");
include_once ('templates/header.php');
$donaddress = $btclient->getaccountaddress($don_faucet);
$don = $btclient->getbalance($don_faucet, 0);
?>
<div class="row">
<div class="span10">
<center>
<br />
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$challengeValue = $_POST['adscaptcha_challenge_field'];
$responseValue = $_POST['adscaptcha_response_field'];
$remoteAddress = $_SERVER["REMOTE_ADDR"];
function ordinal($a)
{
$b = abs($a);
$c = $b % 10;
$e = (($b % 100 < 21 && $b % 100 > 4) ? 'th' : (($c < 4) ? ($c < 3) ? ($c < 2) ?
($c < 1) ? 'th' : 'st' : 'nd' : 'rd' : 'th'));
return $a . $e;
}
if (strtolower(ValidateCaptcha($adscaptchaID, $adsprivkey, $challengeValue, $responseValue,
$remoteAddress)) == "true") {
$isvalid = $btclient->validateaddress($_POST['BTC']);
if ($isvalid['isvalid'] != '1') {
echo "Invalid Address: {$_POST['BTC']}";
echo "</center></div>";
include ('templates/sidebar.php');
include ('templates/footer.php');
die();
} else {
$ltcaddress = $_POST['BTC'];
mysql_query("INSERT INTO subtotal (ltcaddress, ip) VALUES('$ltcaddress', '$ip' ) ") or
die(mysql_error());
$command = "SELECT * FROM dailyltc";
$q = mysql_query($command);
$rows = mysql_num_rows($q);
$entries_needed = 25;
if ($rows > $entries_needed) {
$command = "SELECT * FROM roundltc";
$q = mysql_query($command);
$res = mysql_fetch_array($q);
$list = mysql_query("SELECT * FROM dailyltc");
$coins_in_account = $btclient->getbalance("FaucetDonations", 0);
if ($coins_in_account >= ($res['roundltc'] * $rows)) {
while ($listw = mysql_fetch_array($list)) {
$btclient->sendfrom("FaucetDonations", $listw['ltcaddress'], $res['roundltc']);
}
echo srsnot("Congratulations, you were the placed in the round, the round has been reset and payouts have been sent.");
mysql_query("TRUNCATE dailyltc");
mysql_query("UPDATE round set round=round+1");
$totalc = $res['roundltc'] * $rows;
mysql_query("UPDATE dailytotal set total=total+{$totalc}");
echo "</center></div>";
die();
} else {
echo srserr("Uh oh, looks like we haven't got enough donations to pay out. The round will continue until there's enough to pay out.");
echo "</center></div>";
die();
}
}
//echo "printed.";
// echo "</table>";
echo "You will get your CCN at the end of this round<br />There are $rows submitted addresses in this round!<br>";
echo "<br>If you want to donate to the Faucet: $donaddress (recv: $don)";
}
} else { // Wrong answer, you may display a new AdsCaptcha and add an error message
die ("<h1>The reCAPTCHA wasn't entered correctly.</h1> Go <a href='http://cannacoin.cc/faucet'>back</a> and try it again." ."(reCAPTCHA said: " . $resp->error . ")");
}
?>
</center>
</div>
<?php
include ('templates/sidebar.php');
include ('templates/footer.php');
?>