<?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');
}

$Schema = new Schema($con);
$pos = Statics::SafeInput($con, $_POST['pos']);
if(isset($_POST['edit'])) {
    $edit = Statics::SafeInput($con, $_POST['edit']);
    $Schema->executeQuery('UPDATE VEHICULOS_NOTAS SET NOTA = ? WHERE CLAVE = ? AND POS = ?', 'sii', [$edit, $_SESSION['CODIGO_COCHE'], $pos]);
} else {
    $Schema->executeQuery('DELETE FROM VEHICULOS_NOTAS WHERE CLAVE = ? AND POS = ?', 'ii', [$_SESSION['CODIGO_COCHE'], $pos]);
}


?>