コード例 #1
0
<?php

//Verifico la sesion
include_once "../checkSession.php";
include_once "../functions.php";
$checkArray = array('jugador', 'grupo');
if (checkAllPost($checkArray)) {
    include_once "../classes/conexiones.php";
    include_once "../classes/jugador.php";
    include_once "../classes/grupo.php";
    //MySQL Injection
    $db = new Database();
    $idJ = $db->checkInjection($_POST['jugador']);
    $idG = $db->checkInjection($_POST['grupo']);
    $db->close();
    //Salgo si no es un admin
    $j = new jugador();
    $j->xId($_SESSION['id']);
    if (!$j->isAdmin($idG)) {
        echo "Usted no es administrador de este grupo";
        exit;
    }
    //Creo un grupo y un jugador
    $g = new grupo();
    $g->xId($idG);
    $g->addPlayer($idJ);
}
//FIN isset POST