forked from tuaris/multifaucet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
64 lines (54 loc) · 1.84 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
<?php include('includes/bootstrap.inc.php'); ?>
<?php include('modules/faucet/faucet.lib.php'); ?>
<?php
$FAUCET = new Faucet($DB, $SETTINGS, $PAYMENT_GATEWAY);
$vars['title'] = $LANGUAGE['site_heading'];
$vars['copyright'] = 'Copyright ©' . date("Y") . ' by SecurePayment CC';
//Check if Submitting and validate CAPTCHA
if (isset($_POST["cryptocoin_address"]) &&
faucet_valid_captcha($SETTINGS, $_SERVER["REMOTE_ADDR"], array(
'captcha_code' => @$_POST["captcha_code"],
'recaptcha_response_field' => @$_POST["recaptcha_response_field"],
'recaptcha_challenge_field' => @$_POST["recaptcha_challenge_field"],
'adcopy_challenge' => @$_POST["adcopy_challenge"],
'adcopy_response' => @$_POST["adcopy_response"]))
) {
//Check Spammer Slapper
if(faucet_check_spammerslapper($SETTINGS, $vars)){
//Good CAPTCHA and Spammer Slapper - attempt payout
$FAUCET->payout($_POST["cryptocoin_address"], $_SERVER["REMOTE_ADDR"], @$_POST["promo_code"]);
//Get status
$status = $FAUCET->status();
}
else {
//SpammerSlapper Failed
$status = SF_STATUS_PAYOUT_ERROR;
}
}
elseif (isset($_POST["cryptocoin_address"])) {
//BAD CAPTCHA
$status = SF_STATUS_CAPTCHA_INCORRECT;
}
else{
//No Submition
$status = $FAUCET->status();
}
// statistics:
$vars['stats'] = $FAUCET->get_stats();
//Save Status
$vars['status'] = $status;
//TODO: I need to think of a better way to do this
$show_form = faucet_eval_status($status, $vars, $LANGUAGE, $SETTINGS);
if ($show_form){
// Render Captcha
$vars['captcha'] = faucet_get_captcha($SETTINGS);
// Render Form
$vars['content'] = render_template(faucet_get_content('form'), $vars);
}
else{
// Render Error/Status
$vars['content'] = render_template(faucet_get_content('status'), $vars);
}
// Render full page
print render_template(template_file("page.tpl.php", get_current_theme_name()), $vars);
?>