예제 #1
0
파일: intro.php 프로젝트: vigupe01/desweb
<?php

include 'arrayMenu.php';
include 'lib/Jugador.php';
require_once 'conexionBD.php';
session_start();
$baseDatos = new BaseDatos();
$jugador1 = $_SESSION['jugador'] = new Jugador();
var_dump($_SESSION['jugador']);
if ($jugadorBd = $baseDatos->comprobarUser($_POST['nombre'])) {
    $jugador1->setNombre($jugadorBd['nombre']);
    $jugador1->setApellido($jugadorBd['apellido']);
    $jugador1->setEdad($jugadorBd['edad']);
} else {
    $baseDatos->insertarUser($_POST['nombre'], $_POST['apellido'], $_POST['edad']);
    $jugador1->setNombre($_POST['nombre']);
    $jugador1->setApellido($_POST['apellido']);
    $jugador1->setEdad($_POST['edad']);
}
if ($_POST["juego"] == "junior") {
    $_SESSION['jugador']->setTipo("junior");
} else {
    $_SESSION['jugador']->setTipo("junior+");
}
if ($_POST["submit"] == "Jugar") {
    header('Location: junior.php');
}
?>
<!DOCTYPE html>
<html>
  <head>