hola!!
necesito pasar una variable por todos los archivos una vez que el usuario ha iniciado sesión.
 
Este  es el archivo donde inicia sesión, he puesto (línea en rojo)
<? register_variable("IDUSUARIO"); ?>
para registrar la variable que luego quiero ir pasando por todas las páginas, pero no sé si me falta algo o si está bien puesto.
 
 
 iniciar.php
<html>
<body>
<p>
  <?
 
require('../mysql.php');
 
if (db_open("proyecto")==FALSE) 
{
echo "fallo de conexión";            //Conexion con la base de datos 
exit;
}
 
$usuario=$_POST["usuario"];
$password=$_POST["password"];
 
$sql="select * from usuarios where usuario='$usuario' and password='$password'";
 
if (($query=db_query ($sql))==FALSE)
{
echo "USUARIO NO VÁLIDO";
exit;
}
 
if (db_rows($query)==0) 
{
echo "ERROR";
exit;
}
 
$_SESSION['usuario'] = $usuario;
 
 
?>
 
HA INICIADO SESION CORRECTAMENTE</p>
 
 <? register_variable("IDUSUARIO"); ?>
 
<p><a href="../pagina_inicio/marco_ppal.php" target="_self">página inicial</a></p> 
 
<p> </p>
</body>
</html>
 
 
Luego, según creo, debería poder recuperar la variable en cualquiera de las páginas, por ejemplo, en la página inicial que es la página a la que te dirige esta.y para recuperar la variable (la línea en rojo); pero también me falla, y no sé que es lo que me falta o tengo que añadir.
 
 marco_ppal.php
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
<style type="text/css">
<!--
.Estilo1 {
	font-size: 24px;
	font-weight: bold;
	color: #CC0000;
}
body {
	background-color: #FFFFCC;
}
.Estilo16 {color: #99FFFF}
-->
</style>
</head>
 
<body>
<div align="center" class="Estilo1">TRAVELPEDIA</div>
<p align="center"><img src="MAPAMundo1.gif" alt="" width="546" height="469" />  </p>
 
<?
require ('../mysql.php');
 
 $IDUSUARIO=$SESSION_VARS["IDUSUARIO"];
 
if (db_open("proyecto")==FALSE)            //conexión con BBDD
{
	echo "ERROR DE CONEXIÓN CON BBDD";
	exit;
}
 
$sSQL="select IDCONTINENTE,NOMBRE from continentes ORDER BY NOMBRE"; //seleccionamos dos campos de la tabla continentes
 
$query=db_query($sSQL);         
 
?>
 
 <table width="800" border="0">     
  <tr>
    <td width="80"></a></td>
    <td width="160"></td>
    <td width="190"></td>
    <td width="160"></td>
    <td width="60"></td>
    <td width="80"></td>
	<td width="70"></td>
  </tr>
 
<?
// sacamos los datos del query, imprimimos el nombre del continente y hacemos enlace a continentes_inicio.php enviando la variable IDCONTINENTE
 
while ($row=db_fetch($query))
{
	echo '<td><a href="../continentes/continente_inicio.php?IDCONTINENTE='.$row->IDCONTINENTE.'">'.$row->NOMBRE.'</a></td>';
}
 
 
?>
 
</table>
 
</body>
</html>
 
 
Muchas gracias!!
 
un saludo, 
   
 


