require_once "ayah.php";
//Are You A Human Bot Protection insert your keys in the ayah_config file
//Sign up for a free account at areyouahuman.com to get your keys
require_once "faucetbox.php";
$ayah = new AYAH();
$reefer = $_GET['ref'];
if (!($ipp = filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))) {
    die('Invalid IP address.');
}
$timeRaw = time();
$timeNewUser = time();
$zero = 0;
$claimMsg = "Welcome to Faucet+Dice";
$currency = "BTC";
$faucetbox = new Faucetbox($api_key, $currency);
$faucetBal = $faucetbox->getBalance();
$getfaucetbal2 = $faucetBal["balance_bitcoin"];
if (array_key_exists('start', $_POST)) {
    $time = time();
    $score = $ayah->scoreResult();
    if ($score) {
        $userAddy = $_POST['bitad'];
        if ($reefer == $userAddy) {
            die("You Cant Refer Yourself");
        }
        //check if already in DB
        $checkAddy = $conn->prepare("SELECT * FROM faucetbox WHERE addy = ?");
        $checkAddy->execute(array($userAddy));
        $numrowAddy = count($checkAddy->fetchAll());
        if ($numrowAddy > 0) {
            //returning visitor forward to game area