예제 #1
0
 public function searchUser($userName)
 {
     $user = new Jugador();
     $vector = array($userName);
     $con = new BDDConexion();
     $resultado = $con->launchQuery($this->SELET_USER, $vector);
     if ($resultado != null) {
         foreach ($resultado as $row) {
             $user->setId($row['id']);
             $user->setCodigo($row['codigo']);
             $user->setNombre($row['nombre']);
             $user->setContra($row['contra']);
         }
     }
     return $user;
 }
예제 #2
0
<!DOCTYPE html>

<?php 
include 'Jugador.php';
session_start();
if (isset($_GET['jugador'])) {
    if (!isset($_SESSION['jugador'])) {
        $jugador1 = new Jugador();
        $jugador1->setNombre($_GET['Nombre']);
        $jugador1->setApellido($_GET['Apellido']);
        $jugador1->setPuntos(0);
        $_SESSION['jugador'] = $jugador1;
    } else {
        $jugador1->setNombre($_GET['Nombre']);
        $jugador1->setApellido($_GET['Apellido']);
    }
}
if (isset($_SESSION['jugador'])) {
    $jugador1 = $_SESSION['jugador'];
}
if (isset($_SESSION['jugador'])) {
    $jugador1 = $_SESSION['jugador'];
}
if ($jugador1->getNombre() == null || $jugador1->getApellido() == null) {
    header("Location: index.php");
}
include "configuracion.php";
include "dados_senior.php";
?>

예제 #3
0
     if (empty($_POST['apellidos'])) {
         header("Location: /P05/index.php");
     }
     if (empty($_POST['edad'])) {
         header("Location: /P05/index.php");
     }
 }
 //Si existe el POST jugador
 if (isset($_POST['jugador'])) {
     if (!isset($_SESSION['jugador'])) {
         //Inicializamos y creamos la $_SESSION jugador
         $_SESSION['jugador'] = $jugador;
         //Si existe el registro en la base de datos
         if ($jugadorDB = $db->selectUsuario($_POST['nombre'], $_POST['apellidos'])) {
             //Ponemos nombre al jugador
             $jugador->setNombre($jugadorDB['nombre']);
             $jugador->setApellidos($jugadorDB['apellidos']);
             $jugador->setEdad($jugadorDB['edad']);
             $jugador->setId($jugadorDB['id']);
             $jugador->setPuntos($jugadorDB['puntos']);
         } else {
             $id = $db->insertUsuario($_POST['nombre'], $_POST['apellidos'], $_POST['edad']);
             //Ponemos nombre al jugador
             $jugador->setNombre($_POST['nombre']);
             $jugador->setApellidos($_POST['apellidos']);
             $jugador->setEdad($_POST['edad']);
             $jugador->setId($id);
             $jugador->setPuntos(0);
         }
     } else {
         if (isset($_SESSION['jugador'])) {
예제 #4
0
<?php

include 'Jugador.php';
include 'Carta.php';
?>
<html>
	<head>
		<title>HOLDEM EXAMPLE
		</title>
	</head>
	<body>
		<?php 
$jugador1 = new Jugador();
$jugador2 = new Jugador();
$jugador1->setNombre("Paco");
$jugador2->setNombre("Pepe");
echo $jugador1->getNombre();
echo $jugador2->getNombre();
//Vamos a obtener los palos
echo Carta::TREBOL;
echo Carta::PICA;
?>
	</body>
</html>
예제 #5
0
<?php

include 'Jugador.php';
//Abrimos/reanudamos la sesion con la funcion session start
session_start();
//Comprobamos si realizamos la accion de crear el Jugador
if (isset($_POST['jugador'])) {
    //Comprobamos un objeto creado en la sesion
    if (!isset($_SESSION['jugador'])) {
        $jugador1 = new Jugador();
        $jugador1->setNombre($_POST['nom']);
        //Inicializamos al jugador
        $_SESSION['jugador'] = $jugador1;
    }
}
//Comprobamos un objeto creado en la sesion
if (isset($_SESSION['jugador'])) {
    $jugador1 = $_SESSION['jugador'];
    $jugador1->puntos++;
}
?>
<html>
	<head>
		<title>POO SESSION
		</title>
	</head>
	<body>
	    <div>
    	    <h3>FORMULARIO DE JUGADOR</h3>
    		<form action="poo_session.php" method="post">
    		    <input type="hidden" name="jugador">
예제 #6
0
파일: index.php 프로젝트: victorvte/daw
<?php

include 'objetos.php';
include 'constructores.php';
?>

<!DOCTYPE html>
<html>
    <head>
        <title>EJEMPLO</title>
    </head>
    <body>
        
    <?php 
$jugador1 = new Jugador();
$jugador1->setNombre("Fran");
echo $jugador1->getNombre();
echo Carta::TREBOL;
echo Carta::PICA;
?>
    
        
    </body>
</html>