forked from Reddhead-devs/Reddcoin-faucet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
159 lines (127 loc) · 6.2 KB
/
index.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?php
/*
Copyright (C) 2015 iisurge
Reddcoin-faucet comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions
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 2 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.
*/
include_once 'includes/dbconnect.php';
include "includes/cryptowallet-php-api/config.php";
include "includes/cryptowallet-php-api/lib/jsonRPCClient.php";
include "includes/cryptowallet-php-api/lib/Crypto.php";
$crypt = new Crypto_API($integrity_check, $settings, $server);
//GOOGLE CAPTCHA
$msg='';
if($_SERVER["REQUEST_METHOD"] == "POST") {
$recaptcha=$_POST['g-recaptcha-response'];
if(!empty($recaptcha)) {
include("getCurlData.php");
$google_url="https://www.google.com/recaptcha/api/siteverify";
$secret='Google Secret Key';
$ip=$_SERVER['REMOTE_ADDR'];
$url=$google_url."?secret=".$secret."&response=".$recaptcha."&remoteip=".$ip;
$res=getCurlData($url);
$res= json_decode($res, true);
//reCaptcha success check
if($res['success']) {
//Include login check code
}
else
{
$msg="Please re-enter your reCAPTCHA.";
}
}
else
{
$msg="Please re-enter your reCAPTCHA.";
}
}
if ($crypt->open_connection()) {
?>
<html>
<head>
<title>Faucet</title>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<link href="css/bootstrap.css" rel="stylesheet" />
<link href="faucet.css" rel="stylesheet" />
<script>
$(document).ready(function() {
$("#balf").load('includes/faucet_bal.php');
$(".recents").load('includes/faucet_recents.php');
$("#payedout").load('includes/faucet_payed.php');
$("#today").load('includes/faucet_today.php');
$("#faucetform").submit(function() {
var serializedValues = jQuery("#faucetform").serialize();
jQuery.ajax({ type: 'POST',url:"includes/verify_captcha.php",data: serializedValues,success:function(result){
if(result){
$.post('includes/faucet_pay.php', $('#faucetform').serialize(), function(data) {
if (data == "Success: You have been sent 5 RDD! Please wait atleast 12 hours before redeeming again") {
$("#return").html('<div class="alert alert-success alert-dismissible" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' + data + '</div>');
}else {
$("#return").html('<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span><span class="sr-only">Error:</span> ' + data + '</div>');
}
});
}else {
$("#return").html('<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span><span class="sr-only">Error:</span> Invalid Captcha!</div>');
}
}});
$("#balf").load('includes/faucet_bal.php');
return false;
});
});
function updateShouts(){
$('.recents').load('includes/faucet_recents.php');
$("#balf").load('includes/faucet_bal.php');
}
setInterval('updateShouts()', 10000);
function statupdate(){
$("#payedout").load('includes/faucet_payed.php');
$("#today").load('includes/faucet_today.php');
}
setInterval('statupdate()', 60000);
var onloadCallback = function() {
grecaptcha.render('captcha_ele', {
'sitekey' : '', // google re-captcha Site key
});
};
</script>
</head>
<body>
<div id="return">
</div>
<h1 id="topbal">Faucet Balance: <b id="balf"></b><img src='imgs/logo-only.png' style=' margin-left: 5px; margin-top: -0.33em; height: 1.5em; width: auto; ' /></h1>
<div id="formcontainer">
<form id="faucetform">
<input type="text" name="faucet-pay" class="form-control" placeholder="Rsurge4R9r1XWfPpkRMZ95p7AXsez7tFqw">
<div id="captcha_ele"></div><br />
<input type="submit" style="font-size: 2em;" class="btn btn-success" value="Redeem" />
</form>
</div>
<div class="stats">
<h4 style="padding-top: 5px;">Stats</h4>
Payout: 5<img src='imgs/logo-only.png' style=' margin-left: 5px; margin-top: -0.33em; height: 1.5em; width: auto; ' /><br />
Redemptions In Last 24 Hours: <b id="today"></b><br />
Wait Period: 12 hours<br />
Total Paid Out: <b id="payedout"></b><img src='imgs/logo-only.png' style=' margin-left: 5px; margin-top: -0.33em; height: 1.5em; width: auto; ' /><br />
Direct Faucet Donations:<br /> RmaQLkiebAgCCRTwyz73JZqcPZD47qLH6K <!--PUT YOUR FAUCET ADDRESS HERE -->
<br />
<br />
</div>
<br><br>
<table class="recents" width="98%" border="1" align="center">
</table>
<br /><br /><br />
<script src="js/bootstrap.js"></script>
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit&response=yes" async defer></script>
</body>
</body>
</html>
<?php }else { echo "failed to connect to wallet, please try again later!"; }