Example #1
0
<?php

include_once "../functions.php";
include_once "../classes/evento.php";
$checkArray = array('nombre', 'tipo', 'lugar', 'lat', 'lng', 'direccion', 'fecha', 'hora', 'cantidad', 'grupo');
if (checkAllPost($checkArray)) {
    $db = new Database();
    //Mysql Inyection
    $idG = $db->checkInjection($_POST['grupo']);
    $nombre = $db->checkInjection($_POST['nombre']);
    $tipo = $db->checkInjection($_POST['tipo']);
    $lugar = $db->checkInjection($_POST['lugar']);
    $lat = $db->checkInjection($_POST['lat']);
    $lng = $db->checkInjection($_POST['lng']);
    $direccion = $db->checkInjection($_POST['direccion']);
    $fecha = $db->checkInjection($_POST['fecha']);
    $hora = $db->checkInjection($_POST['hora']);
    $cantidad = $db->checkInjection($_POST['cantidad']);
    //Creo objeto y le asigno los datos
    $e = new evento($nombre, $tipo, $lugar, $lat, $lng, $direccion, $fecha, $hora, $cantidad, $idG);
    return $e->objectToDb();
}