Thanks that worked great -- I didn't know I had to do session_start() on
every page where I wanted to use the session.

On Fri, Oct 10, 2008 at 10:33 AM, Mac Newbold <[EMAIL PROTECTED]> wrote:

> Today at 10:24am, Nathan Lane said:
>
>  How do I ensure that a session isn't already started so that I don't
>> accidentally overwrite my session?
>>
>
> Unless you already have variables by those names stored in your session,
> you can add to the existing session without overwriting anything. You'll
> probably need to add a session_start() before setting the variables, then
> set them in the session rather than as globals. Then your ?page=error can do
> a session_start() and look for those variables in the session, and use them,
> delete them from the session, or whatever.
>
> Mac
>
>
>  On Fri, Oct 10, 2008 at 8:57 AM, David Boucha <[EMAIL PROTECTED]> wrote:
>>
>>  On Fri, Oct 10, 2008 at 8:32 AM, Nathan Lane <[EMAIL PROTECTED]
>>>
>>>> wrote:
>>>>
>>>
>>>  I have a default PHP script in all of my directories and I want them to
>>>> redirect to my error script with some post parameters, or even
>>>> variables,
>>>> and I've tried both but neither seems to do what I expect it to.
>>>>
>>>> <?php
>>>> $contents = "error";
>>>> $errorNumber = 403;
>>>> $errorMessage = "Access Forbidden";
>>>> header("Location: /?page=error");
>>>> ?>
>>>>
>>>> After that script is run I expect the script associated with
>>>> /?page=error
>>>> to
>>>> see that $errorNumber and $errorMessage are set, but it doesn't see
>>>> that.
>>>> Can anybody explain why?
>>>>
>>>
>>>
>>> Nathan,
>>>
>>> When you redirect the user to /?page=error the variables you set above
>>> aren't sent along. If you want to be able to access them, put them in
>>> session variables instead.
>>>
>>> Dave
>>>
>>> _______________________________________________
>>>
>>> UPHPU mailing list
>>> [email protected]
>>> http://uphpu.org/mailman/listinfo/uphpu
>>> IRC: #uphpu on irc.freenode.net
>>>
>>>
>>
>>
>>
>>
> --
> Mac Newbold             MNE - Mac Newbold Enterprises, LLC
> [EMAIL PROTECTED]      http://www.macnewbold.com/
>



-- 
Nathan Lane
Home, http://www.nathandelane.com
Blog, http://nathandelane.blogspot.com

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to