<?php
session_start();
$usuarioSession = $_SESSION['USUARIO'];
$grupo = $_SESSION['GRUPO'];
$contacto = $_SESSION['CONTACTO'];
$awa_session_id = $_SESSION['AWA_SESION_ID'];
include('../includes/conex.php');
include('../includes/eat.php');
include('../includes/historial.php');
include('../includes/functions.php');
include('../includes/esquemas.php');
include('../class/Schema.php');
include('../class/MotherCar.php');
include('../class/Static.php');
if(!isset($usuarioSession) or $awa_session_id != $awa_id) {
    eatCookies();
    header('Location:../index.php');
}
if(isset($_COOKIE['usuario']) AND $_COOKIE['usuario'] != $staticUsu ) {
    eatCookies();
    header('Loction:../index.php');
}
if(isset($_COOKIE['idioma'])) {
    include('../lg/LG_' . $_COOKIE['idioma'] . '.php');
} else {
    include('../lg/LG_SP.php');
}
$IMGs = '';
$Schema = new Schema($con);
$MotherCar = new MotherCar($con);
$rowCar = $MotherCar->getCarData($_SESSION['CODIGO_COCHE']);
foreach($_POST['contenido'] as $c) {
    $c = Statics::SafeInput($con, $c);
    $Schema->executeQuery('UPDATE VEHICULOS_MULTIMEDIA_LINKS SET ACTIVO = ? WHERE CODIGO = ?', 'is', [0, $c]);
    $IMGs .= '<li class="list-group-item">Codigo link: ' . $c . '</li>';
}

$email = "robert.ciotic@dealerbest.com";
$subject = "Denuncia";
$msg = utf8_encode("
<html>
    <head>
        <title>$subject</title>
    </head>
    <body>
        <h3>$vehiculo_lg: " . $rowCar['MOSTRAR'] . "</h3>
        <ul>" . $IMGs . "</ul>
    </body>
</html>
");
$cabeceras  = 'MIME-Version: 1.0' . "\r\n";
$cabeceras .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($email, $subject, $msg, $cabeceras);

header('Location:../resultados-ficha.php?idCAR=' . $_SESSION['CODIGO_COCHE']);

?>