%PDF- %PDF-
| Direktori : /var/www/zanda.mx/ |
| Current File : /var/www/zanda.mx/mensaje.php |
<?php
//Ingresa tu clave secreta.....
define("RECAPTCHA_V3_SECRET_KEY", '6LdET14gAAAAAETjZmICFqmmVRYTzAJG1Bf9KJ5r');
$token = $_POST['token'];
$action = $_POST['action'];
//call curl to POST request
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://www.google.com/recaptcha/api/siteverify");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('secret' => RECAPTCHA_V3_SECRET_KEY, 'response' => $token)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$arrResponse = json_decode($response, true);
//verificar la respuesta
if($arrResponse["success"] == '1' && $arrResponse["action"] == $action && $arrResponse["score"] >= 0.6) {
// Si entra aqui, es un humano, puedes procesar el formulario
$Nombre = $_POST["nombre"];
$Email = $_POST["email"];
$Telefono = $_POST["telefono"];
$Mensaje = $_POST["mensaje"];
$MEDIO = "";
if (isset($_POST["INFORMACION"])){
$MEDIO = $_POST["INFORMACION"];
}
require('class_ith.php');
list($vrNombre,$vrApellido)=fnformatnombre($Nombre);
$comentario="$Mensaje. (Medio: $MEDIO)";
$vrFecha = date("Y-m-d H:i:s");
if (!empty($_POST["fecha"])){
$date = date_create ($_POST["fecha"]);
$fecha= date_format($date,"d/m/Y");
$hora = $_POST["hora"].":00";
$comentario.="||CITA: $fecha|HORA: $hora";
}
$data = array(
'type' => "fnLeadWP",
'name' => $Nombre,
'celular' => $Telefono,
'email' => $Email,
'access' => 10,
'project' => 9,
'company' =>2,
'comentario' =>$comentario
);
$ch = curl_init("https://bsys.mx/siga_ventas/ws_leads_ventas/");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$result = curl_exec($ch); // Submit the POST request
curl_close($ch); // Close cURL session handle
$respuesta=json_decode($result,true);
$Mensaje2 = $Nombre.':<br><br>'.$Mensaje.'<br><hr>Correo: '.$Email.'<br>Cel: '.$Telefono.'<br><br>Solicitó:'.$MEDIO.'<br><br>Fecha: '.$Fecha;
// $cabeceras = 'MIME-Version: 1.0' . "\r\n";
//$cabeceras .= 'Content-type: text/html; charset=utf-8' . "\r\n";
// $cabeceras .= 'From: Cañadas by El Mirador<ventas@canadasdelmirador.com.mx>';
//$enviado = mail("bsy.drt.ventas@gmail.com","Mensaje de ".$Nombre,$Mensaje2,$cabeceras);
//$enviado = mail("erickl8a.elo@gmail.com","Mensaje de ".$Nombre,$Mensaje2,$cabeceras);
// echo "ok!, eres un humano";
} else {
//Si entra aqui, es un robot....
echo "Lo siento, parece que eres un Robot y no se pudieron enviar tus datos";
}
?>