Hola
Como te indico anteriormente, ésto funciona en host local, pero no en web.
Si pongo la instruccion que me dices, me pone que no encuentra la variable nombre.
el código completo es:
inicio.php (recibe mediante post, usuario y contraseña del loguin)
Código PHP:
<?php
$usuario=$_POST['usuario'];
$contra=$_POST['contra'];
include "configsql.php";
$xusuario=strtoupper($usuario);
$consulta="select PASSWORD,DESCRIP,NIVEL,CODIGO,NOMBRE,EMAIL from t4s where password='".$contra."' and descrip='".$usuario."'";
$query=mysql_query($consulta, $connect);
$nombre=mysql_fetch_row ( $query );
$nfilas=mysql_num_rows($query);
if ($nfilas !=0){
//usuario y contraseña válidos
//defino una sesion y guardo datos
session_start();
$_SESSION['usuario']=$usuario;
$_SESSION['contra']=$contra;
$_SESSION['nombre']=$nombre[4];
$_SESSION['email']=$nombre[5];
$fecha=getdate() ;
$dfecha=DATE("d.m.y") ;
$hora =$fecha["hours"]+6;
$mins =$fecha["minutes"];
$mins =STR_PAD(trim($mins),0,'0',STR_PAD_LEFT ); $now =$hora.":".$mins ;
echo "<center><strong><font color='Green' face='Arial'>..........oo00oo..........</font></strong></center>";
echo "<center><strong><font color='Red' face='Arial'>BIENVENIDO ".$nombre[4]."</font></strong></center>";
echo "<center><strong><font color='Green' face='Arial'>..........oo00oo..........</font></strong></center>";
?>
<table width="681" border="0" align="center">
<tr>
<td width="71"><img src="sientate.gif" alt="logo" width="675" height="375" /></td>
</tr>
</table>
<?php
$sql=mysql_query ("INSERT INTO visitas ( NOMBRE,FECHA,HORA) VALUES ('$nombre[1]','$dfecha','$now' );" , $connect);
$result = mysql_query($sql);
echo "<META HTTP-EQUIV=REFRESH CONTENT='6; URL=indice1a.php'>";
}else {
//si no existe le mando otra vez a la portada
echo "<center><strong><font color='Red' face='Arial'>..........oo00oo..........</font></strong></center>";
echo "<center><strong><font color='Red' face='Arial'>ERROR. ENTRADA NO AUTORIZADA</font></strong></center>";
echo "<center><strong><font color='Red' face='Arial'>..........oo00oo..........</font></strong></center>";
echo "<center><strong><font color='Red' face='Arial'>COMPRUEBE DATOS DE USUARIO Y CONTRASEÑA</font></strong></center>";
echo "<center><strong><font color='Red' face='Arial'>..........oo00oo..........</font></strong></center>";
echo "<META HTTP-EQUIV=REFRESH CONTENT='4; URL=indice1.htm'>";
}
?>
aqui el otro fichero
Este ya no recibe variables de la sesion
indice1a.php
Código PHP:
<?php
session_start();
$usuario=$_SESSION['usuario'];
$nombre=$_SESSION['nombre'];
$email=$_SESSION['email'];
if(isset($_SESSION['usuario'])){
?>
<html>
<head>
<!-- Site Title -->
<title>Sieteyocho</title>
<!-- Link to Style External Sheet -->
<link href="css/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
... etc...
Como os indico, por lo que sea, no me llegan las variables de la sesion a éste último, siempre si lo hacemos en web, si lo hago en local con easyphp, funciona perfectamente.
Yo había pensado que era cuestion de los navegadores, pero me pasa igual con iexplore y con firefox.
Saludos