<?php // busca a biblioteca recaptcharequire_once "recaptchalib.php"; ?>
<?php
    include_once("recaptchalib.php");
?>

<!DOCTYPE html>
<html class="bg-black">
    <head>
        
        <meta charset="UTF-8">
        <title>Sistema Processual Breno Paiva Advocacia | Acessar</title>
        <script
      src="https://code.jquery.com/jquery-3.4.1.min.js"
      integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
      crossorigin="anonymous"></script>
  
  <script src="https://www.google.com/recaptcha/api.js" async defer></script>
  
    <script src="https://www.google.com/recaptcha/api.js?render=6LcW14gaAAAAAOuPPqKu0PwTLhzC9GaN6ah2Yc3s"></script>
    
    <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
        
        
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
            <link href="<?php echo base_url('assets/css/bootstrap.min.css')?>" rel="stylesheet" type="text/css" />
    <!-- font Awesome -->
    <link href="<?php echo base_url('assets/css/font-awesome.min.css')?>" rel="stylesheet" type="text/css" />
    <!-- Ionicons -->
    <link href="<?php echo base_url('assets/css/ionicons.min.css')?>" rel="stylesheet" type="text/css" />
    <!-- Morris chart -->
    <link href="<?php echo base_url('assets/css/morris/morris.css')?>" rel="stylesheet" type="text/css" />
	<link href="<?php echo base_url('assets/css/pickmeup.min.css')?>" rel="stylesheet" type="text/css" />
  
    <!-- Theme style -->
    <link href="<?php echo base_url('assets/css/AdminLTE.css')?>" rel="stylesheet" type="text/css" />
    
    
    <!-- jQuery 2.0.2 -->
    <script src="<?php echo base_url('assets/js/jquery.js')?>"></script>
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->
    </head>
    <body class="bg-black">
			<?php 
			
				if($this->session->flashdata('message'))
						$message = $this->session->flashdata('message');
				  if($this->session->flashdata('error'))
						$error  = $this->session->flashdata('error');
			?>
			
            <?php if(!empty($error) || !empty($message)){ ?>
			<div class="container" style="margin-top:20px;">
					
                    <?php if (!empty($error)): ?>
                    <div class="alert alert-danger alert-dismissable col-md-11">
                        <i class="fa fa-ban"></i>
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                        <?php echo $error; ?>
                    </div>
                    <?php endif; ?>
                    
                    <?php if (!empty($message)): ?>
                    <div class="alert alert-info alert-dismissable col-md-11">
                        <i class="fa fa-info"></i>
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                       <?php echo $message; ?>
                    </div>
                    <?php endif; ?>
                    
           </div>
           <?php }?>
        <div class="form-box" id="login-box">
	<td width=200 valign=top style='width:141.55pt;padding:0cm 5.4pt 0cm 5.4pt'>
 
  </td>
            <div class="header"> <p class=MsoNoSpacing align=center style='text-align:center'><a target="_blank" href="http://www.brenopaiva.adv.br/processos"><span style='mso-no-proof:yes'><img
  border=0 width=170 height=60 id="_x0000_i1029"
  src="http://www.brenopaiva.adv.br/img/Nova logo Breno Paiva Adv site.jpg"
  alt="Resultado de imagem para sistema juridico online "></span></a></p><?php echo lang('sign_in')?></div>
            
            <form action="<?php echo site_url('admin/login/login')?>" method="post">
                <div class="body bg-gray">
                    <div class="form-group">
                        <input type="text" name="username" class="form-control" placeholder="<?php echo lang('username')?>"/>
                    </div>
                    <div class="form-group">
                        <input type="password" name="password" class="form-control" placeholder="<?php echo lang('password')?>"/>
                    </div>
                      
                          
                         <!-- CAPTCHA do Cloudflare -->
        <div class="cf-turnstile" data-sitekey="0x4AAAAAAAhZwS0RCcUstiWQ"></div>
                       
                        <br/>
                             <input type="checkbox" name="remember_me"/> <?php echo lang('remember_me')?>
						<input type="hidden" value="admin/admin" name="redirect">
						
						<div class="h-captcha" data-sitekey="11c0bf14-ec1e-4870-bb8a-e226457adce0"></div>
<script src="https://hcaptcha.com/1/api.js" async defer></script>

						
						<input type="hidden" value="submitted" name="submitted">
						
                </div>
                <div class="footer">
                    <button type="submit" class="btn bg-olive btn-block"><?php echo lang('sign_in')?></button>

                    <p><a href="<?php echo site_url('forgot/forgot_password')?>"><?php echo lang('i_forgot_my_password')?></a></p>
                    


                </div>
                
                <p class=MsoNoSpacing align=center style='text-align:center'><span><font size="1">Breno Paiva Advocacia - Gerência de Tecnologia da Informação</font></span></p>
            </form>
                 <script src="https://hcaptcha.com/1/api.js" async defer></script>
                 <?php
$data = array(
            'secret' => "my-secret (should start with 0x..)",
            'response' => $_POST['h-captcha-response']
        );
$verify = curl_init();
curl_setopt($verify, CURLOPT_URL, "https://hcaptcha.com/siteverify");
curl_setopt($verify, CURLOPT_POST, true);
curl_setopt($verify, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($verify, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($verify);
// var_dump($response);
$responseData = json_decode($response);
if($responseData->success) {
    // your success code goes here
} 
else {
   // return error to user; they did not pass
}
?>
                 
                 
                 
                 
                 
                 
                 
             <?php
 if(isset($_POST['submit']) && $_POST['submit'] == 'SUBMIT'){
  if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response']))
  {
        $secret = '6LfI4Y8aAAAAAJM92qwRONJ3b9npOfD-K86THHbS';
        $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
        $responseData = json_decode($verifyResponse);
        if($responseData->success)
        { ?>
<div style="color: limegreen;"><b>Your contact request have submitted successfully.</b></div>
        <?php }
        else
        {?>
            <div style="color: red;"><b>Robot verification failed, please try again.</b></div>
        <?php }
   }else{?>
       <div style="color: red;"><b>Please do the robot verification.</b></div>
   <?php }
 }
?>    
                 
                 
                 
                 
                 
                 
                 
                 
                 
                 
                   <!--js--> <script src='https://www.google.com/recaptcha/api.js?hl=pt-BR'></script>
                   
                   
                   <?php foreach ($_POST as $key => $value) { echo '<p><strong>' . $key.':</strong> '.$value.'</p>'; }?>
 

           
        </div>
        
        
       
        
        
        
<script>
  function Cap(){
        var form = $("#form").serializeArray();
        var url = "valida.php";
        if($("#palavra").val().length){
            $.post(url, form, function(data){
                if(data == 'error'){
                    $("#submit").prop("disabled", true);
                }else{
                    $("#submit").prop("disabled", false);
                }
            });
        }else{
            $("submit").prop("disabled", true);
        }
    }
  
  
  
  function enableBtn(){ document.getElementById("button1").disabled = false; }
  
    $('#form-box').submit(function(event) {
        event.preventDefault();
        var email = $('#email').val();
  
  
        grecaptcha.ready(function() {
            grecaptcha.execute('6LcW14gaAAAAAP5RgUcRqCuObeIDooiU_FVPFmd1', {action: 'submitted'}).then(function(token) {
                $('#newsletterForm').prepend('<input type="hidden" name="token" value="' + token + '">');
                $('#newsletterForm').prepend('<input type="hidden" name="action" value="submitted">');
                $('#newsletterForm').unbind('submit').submit();
            });;
        });
  });
  </script>
       
<?php
if (isset($_POST['submit'])) {
    $data = array(
        'secret' => "ES_70bea688bf044b7b949e072e3f8db852",
        'response' => $_POST['h-captcha-response']
    );
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://hcaptcha.com/siteverify");
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    $responseData = json_decode($response);
    if($responseData->success) {
        // proceed the form
    } else {
        echo 'Robot verification failed, please try again.';
    }
}
?>

       
       
    </body>
	     <script src="<?php echo base_url('assets/js/jquery-ui-1.10.3.min.js')?>" type="text/javascript"></script>
	        <script src="<?php echo base_url('assets/js/bootstrap.min.js')?>" type="text/javascript"></script>

</html>
