Re: [PHP4BETA] Session Question
| From: | fredo | Date: | Wed, 14 Jun 2000 22:00:37 +0000 |
| Subject: | Re: [PHP4BETA] Session Question | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-16287@lists.php.net to get a copy of this message | ||
check if register_globals = on in php.ini
Sergio García Murillo <sergio.garcia@tecnet-sports.com> wrote in message
news:031d01bfd61d$4923ecb0$3700000a@valinor...
I have a funciton in the begining of the page which checks that a variable
"id" is registered in a session..
in the first pagei strat a new session and set the idto 1 and register the
variable..
function set_id($user,$pwd)
{
global $id;
$db = new FumarelDb();
$query="select cod_usuario
from usuarios
where username='$user' and pwd='$pwd'";
if(!$db->query($query)>0)
return false;
$db->next();
$id=$db->f("cod_usuario");
session_start();
session_register("id");
return $id;
}
and then in the other page trying this way
function get_id()
{
global $id;
session_start();
if(!session_is_registered("id"))
return false;
echo $id;
return $id;
}
doesn't output nothing .. but changing the global line..
function get_id()
{
session_start();
if(!session_is_registered("id"))
return false;
global $id;
echo $id;
return $id;
}
outputs the rigth id...
Why? what am i doing wrong??