session only for who needs it
| From: | Mattia | Date: | Thu, 26 Dec 2002 02:59:02 +0000 |
| Subject: | session only for who needs it | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-92823@lists.php.net to get a copy of this message | ||
I have a site in wich user can register, but everyone can navigate as
Guest, even if he/she is nt registered.
The problem is that I need session for registered user, but I don't
need them for unregistered ones!
So I tried to check if they already have an opened session (they are
registered), but to check it I have to do a session_start(), and this
will OPEN a session if it's not opened! So I'll have an opened session
for every guest I have in the site. This is difficult for me because I
would like session to last very long, and many empty session waste a
lot of space!
so session_start() must be like
void session_start()
{
if( [cookie_on_client] == [sess_file_on_server] )
{
look_up_the_file [...]
}
else
{
// create new session
create sess_file_on_server
give corresponding cookie to client
} ...
}
but I would need a function like
bool session_check()
{
if( [cookie_on_client] == [sess_file_on_server] )
{
return true;
}
else
{
return false;
}
}
Is it possible to do it with the PHP session API, without hacking the
code, go and read the session files,...?
any hint is appreciated.
bye
Mattia Cazzola