$_SESSION['jugador'] = $jugador1; } if (isset($_POST['puntos'])) { $puntos = $_SESSION['jugador']->getPuntos(); $db->actualizarPuntos($_SESSION['jugador']->getNombre(), intval($puntos)); } if (isset($_POST['reiniciar'])) { $db->reiniciarPuntos($_SESSION['jugador']->getNombre(), 0); $_SESSION['jugador']->setPuntos(0); } //Se crea el objeto jugador if (isset($_POST['jugador'])) { //Comprobamos un objeto creado en la sesion if (!$db->comprobarUsuario($_POST['nombre'], $_POST['apellidos'])) { header('Location: registro.php'); //$jugador1 = new Jugador($_POST['nombre'],$_POST['apellidos'],$_POST['edad'],$_POST['tipoJuego'],$_POST['lang']); //Inicializamos al jugador //$_SESSION['jugador'] = $jugador1; } else { //Falta recoger los datos de la BBDD para hacer el login $jugador1 = new Jugador($_POST['nombre'], $_POST['apellidos'], $db->getEdad($_POST['nombre'], $_POST['apellidos']), $db->getTipoJuego($_POST['nombre'], $_POST['apellidos']), $db->getIdioma($_POST['nombre'], $_POST['apellidos'])); $_SESSION['jugador'] = $jugador1; } } else { if (isset($_SESSION['jugador'])) { //Inicializamos al jugador $jugador1 = $_SESSION['jugador']; } else { header('Location: index.php'); } }