-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
54 lines (39 loc) · 1.49 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
include_once 'apivisitantes.php';
$api = new ApiVisitantes();
$email = '';
$asunto = '';
$mensaje = '';
$telefono = '';
$error = '';
if(isset($_POST['email']) && isset($_POST['asunto']) && isset($_POST['mensaje'])){
$item = array(
'email' => $_POST['email'],
'asunto' => $_POST['asunto'],
'telefono' => $_POST['telefono'],
'mensaje' => $_POST['mensaje']
);
$api->add($item);
//enviar formulario
$email = $_POST['email'];
$asunto = $_POST['asunto'];
$telefono = $_POST['telefono'];
$mensaje = $_POST['mensaje'];
$header = 'From: ' . $email . " \r\n";
$header .= "X-Mailer: PHP/" . phpversion() . " \r\n";
$header .= "Mime-Version: 1.0 \r\n";
$header .= "Content-Type: text/plain";
$cuerpomsj = "Asunto de la consulta " . $asunto . ",\r\n";
$cuerpomsj .= "Su email es: " . $email . " \r\n";
$cuerpomsj .= "Su teléfono es: " . $telefono . " \r\n";
$cuerpomsj .= "Mensaje: " . $_POST['mensaje'] . " \r\n";
$cuerpomsj .= "Enviado el " . date('d/m/Y', time());
$paracorreo = '[email protected]';
$asuntocorreo = $asunto;
mail($paracorreo, $asuntocorreo, utf8_decode($cuerpomsj), $header);
header("Location:index.html");
}else{
$api->printJSON_err('Falta el email o el asunto o el mensaje');
$api->getAll();
}
?>