Matt, I'm not sure I understand your situation, but here's how
I use sessions:
1. at the start of every PHP script, do "session_start();"
2. after session_start(), for every session variable you
want to register, do "session_register("var_name");"
3. from that point forward, to give that session variable
a value, that will be carried forward into other scripts
(after the other script does a "session_start()"),
just do
$var_name = "new value";
or to print the current value of $var_name, just do
echo "Value of session variable \$var_name = $var_name";
that's it.
You only need to do session_destroy() when you actually want
to destroy all the session variables for the current session -
if you do that in every script, then you obviously won't be
carrying over any session variable values from one script
to the next.
HTH.
--
Hardy Merrill
Mission Critical Linux, Inc.
http://www.missioncriticallinux.com
Matthew Mundy [[EMAIL PROTECTED]] wrote:
> Hello all.
> Sorry, I know sessions come up a lot.
> I am attempting to use sessions for login tracking. The session starts
> fine, sends the cookie fine(login as the session name), registers login as
> a session var, then location should switch to index. all my files except
> login include() a file called header.php which if login is not registered
> redirects to login. Except login is never registered when it hits header.
> The code I use to initialize the session is below. Also, no data is saved
> in /tmp as it should be. I missed something. I just can't figure out
> what. :( Any help would be appreciated. Thanks in advance.
> ---Matt
>
> if ($success)
> {
> //set the session name to the login, start the session,
> register the login in the session
> //destroy any old data
> @session_destroy();
> session_name($login);
> session_start();
> session_register("login");
> header ("Location: index.php");
> exit;
> }
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]