include("header.php"); ?>
$enviado = false;
if ($_POST){
/* if(!strstr($info, "true")){
echo "NOPE (Failed Verification)";
}
else{
echo "YUP (Successful Verification)";
} */
$captcha = $_POST["g-recaptcha-response"]; //Get Captcha token
$secret_key = "6LcXPwUTAAAAALBOdjYzNIMPdNAn3-YsBiqmwBkV"; //Get Secret key
//$google_response = http_get("https://www.google.com/recaptcha/api/siteverify", array("secret"=>$secret_key, "response"=>$captcha), $info); //perform Get request
print_r($info);
// Get resource
$curl = curl_init();
// Configure options, incl. post-variables to send.
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'https://www.google.com/recaptcha/api/siteverify',
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => array(
'secret' => $secret_key,
'response' => $_POST['g-recaptcha-response']
)
));
// Send request. Due to CURLOPT_RETURNTRANSFER, this will return reply as string.
$resp = curl_exec($curl);
// Free resources.
curl_close($curl);
// Validate response
if(strpos($resp, '"success": true') !== FALSE) {
$recaptcha = true;
} else {
$recaptcha = false;
}
if ( $recaptcha ){
require("phpMailer_v2.3/class.phpmailer.php");
$Subject = "[CONTATO] Site ";
$data_hoje = date('Y-m-d');
$data_1seman = date('Y-m-d', strtotime("-7 days"));
$body ="
Líderes,
Temos algums visitantes, que na última semana foram ao culto, para você entrar em contato e convida-las para sua célula:
";
// Inicia a classe PHPMailer
$mail = new PHPMailer();
// Define os dados do servidor e tipo de conexao
$mail->IsSMTP(); // Define que a mensagem será SMTP
$mail->Host = "smtp.boladeneve.com"; // Endereço do servidor SMTP
$mail->SMTPAuth = true; // Autenticaçao
$mail->Username = 'sib@boladeneve.com'; // Usuário do servidor SMTP
$mail->Password = 'igsi8899'; // Senha da caixa postal utilizada
$mail->Port = 587; // Senha da caixa postal utilizada
// Define o remetente
$mail->From = "contato@boladeneve.com";
$mail->FromName = "Contato";
$mail->IsHTML(true); // Define que o e-mail será enviado como HTML
//$mail->CharSet = 'iso-8859-1'; // Charset da mensagem (opcional)
$mail->AddAddress("contato@boladeneve.com","");
$mail->AddBCC("sib@boladeneve.com","");
// Texto e Assunto
$mail->Subject = $Subject; // Assunto da mensagem
$body ="
Contato via site
";
while (list($fname, $fval) = each($_POST)) {
if ($fname !="acao" and $fname != "p" and $fname != "g-recaptcha-response" )
$body .= $fname . " : " . $fval . "
";
}
$body .='';
$mail->Body = utf8_decode($body.$dados_visitantes);
$enviado = $mail->Send();
// Limpa os destinatários e os anexos
$mail->ClearAllRecipients();
$mail->ClearAttachments();
if ($enviado) {
//INSERE
$sql34 = "INSERT INTO b_mailing_contato ( `de` , de_nome , `para` ,assunto, mensagem )
VALUES ( '".trim($_POST['Email'])."' , 'SIB','".trim($para)."','Contato', '".$body."' )
";
mysql_query ($sql34,$conexao);
}
}
}
$time = time();
$code = md5($time);
$_SESSION['time'] = $time;
$_SESSION['code'] = $code;
?>
include ("menu.php"); ?>
if($enviado) echo '
Contato envido com sucesso!
'?>
Contate-nos
include ("footer.php"); ?>
include ("js.php"); ?>