<?php
   //http://stackoverflow.com/questions/18382740/cors-not-working-php
include '../comunes_php/cors.php';
include '../comunes_php/Log.class.php'; 
$log = new Log("app_trace", "./");


$id = intval($_REQUEST['id']);
$nombre = $_REQUEST['nombre'];
$lunes=$_REQUEST['lunes'];
$martes=$_REQUEST['martes'];
$miercoles=$_REQUEST['miercoles'];
$jueves=$_REQUEST['jueves'];
$viernes=$_REQUEST['viernes'];

$sabado=$_REQUEST['sabado'];
$domingo=$_REQUEST['domingo'];
include 'tabla.php';
include '../rdb/conn.php';

$sql = "insert into $tabla (id,
nombre,
lunes,
martes,
miercoles,
jueves,
viernes,
sabado,
domingo) values ($id,
'$nombre',
'$lunes',
'$martes',
'$miercoles',
'$jueves',
'$viernes',
'$sabado',
'$domingo')";

@mysqli_query( $conn,$sql);
        $log->insert($sql, false, false, false);


echo json_encode(array(
	'id' => mysqli_insert_id($conn),
	'nombre' => $nombre,	
	'lunes' => $lunes,
	'martes' => $martes,	
	'miercoles' => $miercoles,
	'jueves' => $jueves,
	'viernes' => $viernes,
	'sabado'=> $sabado,
	'domingo'=> $domingo,
	'sql'=>$sql
));

?>