Файловый менеджер - Редактировать - /home2/cocinasdalloway/public_html/enviar_mensaje.php
Назад
<?php $nombre=$_POST['name']; $email=$_POST['email']; $mensaje1=$_POST['message']; if(isset($_POST['g-recaptcha-response'])){ $captcha=$_POST['g-recaptcha-response']; } if(!$captcha){ header("refresh:3;url=https://www.cocinasdalloway.com/contacto.html"); echo 'Selecciona el captcha. Redirigiendo...'; exit; } $secretKey = "6Lfsq2UjAAAAACMUoUY6h0raUscxGVqAeSBAn937"; $ip = $_SERVER['REMOTE_ADDR']; // post request to server $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($secretKey) . '&response=' . urlencode($captcha); $response = file_get_contents($url); $responseKeys = json_decode($response,true); // should return JSON with success as true if($responseKeys["success"]) { $mensaje=''; $para = 'ventas@cocinasdalloway.com'; //$para = 'aaron0609.ac@gmail.com'; $titulo = 'Contacto Pagina Web'; $mensaje .= 'Mensaje recibido a traves del modulo contacto COCINASDALLOWAY.COM <br/><br/> <strong>Contacto:</strong> '.$nombre.'<br/><br/>'. '<strong>Email:</strong> '.$email.'<br/><br/>'. '<strong>Mensaje:</strong> '.$mensaje1.'<br/><br/>'; if(isset($_FILES['archivo']) and $_FILES['archivo']['size']>0){ //Get uploaded file data $file_tmp_name = $_FILES['archivo']['tmp_name']; $file_name = $_FILES['archivo']['name']; $file_size = $_FILES['archivo']['size']; $file_type = $_FILES['archivo']['type']; $file_error = $_FILES['archivo']['error']; if($file_error > 0) { die('Upload error or No files uploaded'); } //read from the uploaded file & base64_encode content for the mail $handle = fopen($file_tmp_name, "r"); $content = fread($handle, $file_size); fclose($handle); $encoded_content = chunk_split(base64_encode($content)); } $boundary = md5("sanwebe"); //header $headers = "MIME-Version: 1.0\r\n"; $headers .= "From:webmaster@cocinasdalloway.com\r\n"; //$headers .= "Reply-To: ".$reply_to_email."" . "\r\n"; $headers .= "Content-Type: multipart/mixed; boundary = $boundary\r\n\r\n"; //plain text $body = "--$boundary\r\n"; $body .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $body .= "Content-Transfer-Encoding: base64\r\n\r\n"; $body .= chunk_split(base64_encode($mensaje)); if(isset($_FILES['archivo']) and $_FILES['archivo']['size']>0){ //attachment $body .= "--$boundary\r\n"; $body .="Content-Type: $file_type; name=".$file_name."\r\n"; $body .="Content-Disposition: attachment; filename=".$file_name."\r\n"; $body .="Content-Transfer-Encoding: base64\r\n"; $body .="X-Attachment-Id: ".rand(1000,99999)."\r\n\r\n"; $body .= $encoded_content; } if(mail($para, $titulo, $body, $headers)) { header('Location: http://www.cocinasdalloway.com/'); exit; }else{ echo $errorMessage = error_get_last()['message']; } }else{ header("refresh:5;url=https://www.cocinasdalloway.com/contacto.html"); echo 'You are spammer !'; } ?>
| ver. 1.4 |
Github
|
.
| PHP 8.2.22 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка