Greetings, sheldonlg.
In reply to Your message dated Wednesday, July 2, 2008, 22:55:38,
Quote:
Here is what I would like to do, but there seems to be a chicken and egg
situation. I would like to name the session as $thename =
'somekindoftext' . time(); I want to do this upon entering the base
page. Now, as I understand it, on every page I would then have:
Quote:
session_name($thename);
session_start();
It looks you want to generate session id, not session name.
Let me explain.
session_name() - sets the NAME of the session variable that will be used to
track sessions. It is the same for all users, and session_start looking for it
to retrieve session id.
session_id() - sets the actual session identifier, representing exact user who
browsing your pages. Actual "name" of the *user*.
Quote:
However, where do these pages get the value of $thename from?
That's undefined in your example, excluding some rare, monstrous variants...
Quote:
Also, if we reenter the base page where the session name is generated,
Session name should not be generated.
Quote:
does that start a whole new session and we would lose all prior information
from the previous named session?
Session started by calling session_start() or session_register().
Calling session_name(), session_id() does nothing on that end.
Quote:
So, here is what I see:
Quote:
in index.php:
$sessionName = 'somekindoftext' . time();
session_name($sessionName);
session_start;
Quote:
in all succeeding pages:
What????
Nothing.
Create a 'session.php' like:
<?php
if(!array_key_exist(session_name(), $_REQUEST))
{
session_id('somekindoftext' . strval(time()));
}
session_start();
?>
and include it in every your file that require session handling.
P.S.
I've had real use of custom session ids only once:
When I had to write CLI PHP script which were want to store some data between
runs. I've used constant session ID made from script name and version to
restart previously saved session.
--
Sincerely Yours, AnrDaemon <anrdaemon@freemail.ru>