Hola tengo un sistema de sesiones en PHP con base datos en MYSQL y nada me loguea todo bien me inicia sesión etc...pero a la hora de mostrar los datos del usuario que esta logueado osea los datos de la base de datos de ese usuario no consigo que me los muestre..y debe de ser por una tontería pero no me los muestra. Quiero que se loguee en su cuenta y cuando entre le muestre sus datos personales Nombre Apellidos etc...dentro de un formulario editable pero no me los saca...Os pongo los php que utilizo a ver si veis que falla..
login.php
Código PHP:
<?php
/*Guardar datos Cliente*/
$loginCorrecto = false;
/*Copmprobacion cookies" : */
session_start();
if(isset($_SESSION["usNick"]) && isset($_SESSION["usPass"]))
{
$_SESSION["autentificado"]= "SI";
/*resultado de nick y pass guardado por las cookies */
$result = mysql_query("SELECT * FROM Clientes WHERE login='".$_SESSION["usNick"]."' AND pass='".$_SESSION["usPass"]."'");
if($row = mysql_fetch_array($result) && (time() < $_SESSION['caduca']) )
{
/*si los datos son correctos se actualizan las cookiees caducan a los 90 dias*/
$loginCorrecto = true;
}
else
{
//Destruimos las cookies.
$_SESSION = array();
session_destroy();
}
}
?>
Y esta es la cuenta.php donde accede el usuario al loguearse correctamente y en la que aparece un formulario form1 con los datos personales...tengo puesto $row nombre etc...pero asi no lo saca...
Código PHP:
<?php
include("conectarse_bd.php");
include("login.php");
if($loginCorrecto)
{
$mostrar = "Bienvenido !!!!";
}
else
{
$mostrar = 'Bienvenido visitante, el sistema no te ha reconocido, sino te autentificas no podras realizar ninguna de las funciones';
//falla
header("Location: acceso.html");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Nogues | Arquitecto</title>
<script type="text/javascript" src="Funciones.js"></script>
<link rel="stylesheet" type="text/css" href="Estilo.css"/>
</head>
<body>
<div id="Contenedor">
<div id="Capa_titulo_admin">
<div id="logo" onclick="location='index.html'" title="Inicio" ></div>
</div>
<div id="Capa_admin">
<?php
echo "<p style='font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; font-weight: bold; float:right;' > Usuario ".$_SESSION['usNick']." ";
?>
<form id="form1" method="post" action="">
<fieldset class="clase1"><legend>Datos Personales</legend>
<label for="nombre">Nombre</label><input name="nombre" type="text" id="nombre" value= "<?php $row["nombre"];?>" size="40" readonly="readonly"/>
<br />
<label for="apellidom">Apellido </label><input name="apellido1" type="text" id="apellido1" value= "<?php echo $row["apellido1"];?>" size="40" readonly="readonly"/>
<br />
<label for="apellidop">Apellido </label><input name="apellido2" type="text" id="apellido2" value= "<?php echo $row["apellido2"];?>" size="40" readonly="readonly" />
<br />
<label for="Email">Email</label>
<input name="mail" type="text" id="mail" value= "<?php echo $row["mail"];?>" size="40" readonly="readonly"/>
<br />
<label for="telefono">Telefono</label><input name="telefono" type="text" id="telefono" value= "<?php echo $row["telefono"];?>" size="40" readonly="readonly" />
<br />
<label for="direccion">Dirección</label><input name="direccion" type="text" id="direccion" value= "<?php echo $row["direccion"];?>" size="40" readonly="readonly" />
<br />
</fieldset>
<fieldset class="clase1"><legend>Trabajos en curso</legend>
<?php
$sql="SELECT * FROM Expedientes WHERE dni='$dniUsuarioL'";
$link = "<a href=\"cuenta2.php?expediente=%s\">%s<br></a>";
$result = mysql_query($sql);
if(isset($result) && mysql_num_rows($result)>0)
{
while($fila=mysql_fetch_assoc($result))
{
echo sprintf( $link, $fila['expediente'], $fila['nombre'] );
echo "<br>";
}
}
?>
</fieldset>
</form>
<?
//si hay resultados crea tabla
if ($row = mysql_fetch_array($result)){
echo "<table border = '1'> \n";
//Mostramos los nombres de las tablas
mysql_field_seek($result,0);
echo "<tr> \n";
echo "<td style='font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; font-weight: bold;' <b>Fecha</b></td> \n";
echo "<td style='font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; font-weight: bold;' <b>Nombre</b></td> \n";
echo "<td style='font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; font-weight: bold;' <b>Ver</b></td> \n";
echo "<td style='font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; font-weight: bold;' <b>Eliminar</b></td> \n";
echo "<td style='font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; font-weight: bold;' <b>Modificar</b></td> \n";
echo " </tr> \n";
echo "</tr> \n";
do {
echo "<tr> \n"; //para ver el cliente entero
?><form name="form1" method="post" action="datos_expedientes.php">
<?
echo "<td>"?>
<textarea cols="22" rows="1" name="fecha" readonly style="overflow:auto; border-width: 2px; font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; text-align:center;"><?php echo $row["fecha"];?></textarea>
</TD>
<? "</td> \n";
echo "<td>"?>
<textarea cols="70" rows="1" name="nombre" readonly style="overflow:auto; border-width: 2px; font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; text-align:center;"><?php echo $row["nombre"];?></textarea>
<? "</td> \n";
?>
<?
echo "<td>"?>
<input type="submit" name="Submit" value="Ver detalles" style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; text-align:center;"></TD>
</form>
<? echo "<td>"?>
<form name="form" method="post" action="confirmacion_baja_exp.php">
<input name="expediente" type="hidden" value="<? echo $row["expediente"]; ?>">
<input type="submit" name="Submit2" value="Eliminar" style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; text-align:center;"></TD>
</form>
<? echo "<td>"?>
<form name="form" method="post" action="modificar_expediente.php">
<input name="expediente" type="hidden" value="<? echo $row["expediente"]; ?>">
<input type="submit" name="Submit2" value="Modificar" style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;color: #000000; text-align:center;"></TD>
</form>
<?
"</td> \n"; ?>
<?
echo "</tr> \n";
} while ($row = mysql_fetch_array($result));
}
?>
</table>
</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><a href="cerrar_sesion.php">Cerrar sesión</a> </p>
</div>
</div>
</body>
</html>
Perdonad el ladrillo, Gracias de antemano...