40 lines
598 B
PHP
Executable File
40 lines
598 B
PHP
Executable File
<?php
|
|
|
|
session_start ();
|
|
|
|
$params = array
|
|
(
|
|
'name'
|
|
,'pc'
|
|
,'phone'
|
|
,'email'
|
|
,'message'
|
|
,'captcha'
|
|
);
|
|
|
|
$paramsOk = TRUE;
|
|
|
|
foreach ($params as $param)
|
|
if (!isset ($_POST[$param]) || $_POST[$param] == '')
|
|
{
|
|
$paramsOk = FALSE;
|
|
break;
|
|
}
|
|
|
|
header ('Content-Type: application/json');
|
|
|
|
if ($paramsOk && isset ($_SESSION['captcha'])
|
|
&& $_POST['captcha'] == $_SESSION['captcha'])
|
|
{
|
|
mail ('comunicacion@verdnatura.es', 'Verdnatura', print_r ($_POST, TRUE),
|
|
'From: Verdnatura <www-data@verdnatura.es>');
|
|
|
|
echo json_encode (TRUE);
|
|
}
|
|
else
|
|
echo json_encode (FALSE);
|
|
|
|
unset ($_SESSION['captcha']);
|
|
|
|
?>
|