forked from Salmen2/Simple-Faucet-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify.php
45 lines (41 loc) · 1.38 KB
/
verify.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
<?php
include("includes/core.php");
$content = "";
if($user){
$nextClaim = $user['last_claim'] + ($timer * 60);
if(time() < $nextClaim){
header("Location: index.php");
exit;
}
if(!isset($_POST['token']) || $_POST['token'] !== $_SESSION['token']) {
unset($_SESSION['token']);
$_SESSION['token'] = md5(md5(uniqid().uniqid().mt_rand()));
exit;
}
unset($_SESSION['token']);
$_SESSION['token'] = md5(md5(uniqid().uniqid().mt_rand()));
if(isset($_POST['verifykey'])){
if($_POST['verifykey'] != $user['claim_cryptokey']){
$content .= alert("danger", "Claim failed. <a href='index.php'>Go back</a>");
} else {
$reCaptchaPubKey = $mysqli->query("SELECT * FROM faucet_settings WHERE id = '9' LIMIT 1")->fetch_assoc()['value'];
$content .= "<h1>2. Solve Captcha</h1><br />
<form method='post' action='index.php?c=1'>
<div class='form-group'>
<center><div class='g-recaptcha' data-sitekey='".$reCaptchaPubKey."'></div></center>
</div>
<input type='hidden' name='verifykey' value='".$user['claim_cryptokey']."'/>
<input type='hidden' name='token' value='".$_SESSION['token']."'/>
<button type='submit' class='btn btn-success'>Claim</button>
</form>";
}
} else {
$content .= alert("danger", "Abusing the system is not allowed. <a href='index.php'>Go back</a>");
}
} else {
header("Location: index.php");
exit;
}
$tpl->assign("content", $content);
$tpl->display();
?>