[FX.php List] Do session always work?

Kevin Futter kfutter at sbc.melb.catholic.edu.au
Sun Oct 29 22:28:43 MST 2006


On 30/10/06 4:06 PM, "Jonathan Schwartz" <jonathan at eschwartz.com> wrote:

> Did a quick test.  I turned off cookies on my own browser and got the
> same results reported from others.
> 
> Then, I quickly switch from POST to GET (without any other changes)
> in the first couple of pages and it seemed to work as advertised.
> Need to take a closed look to be sure.
> 
> That being said, how do you implement this?  With two complete sets
> of pages: one with POST and ONE with GET and a test to determine
> which to use?   Or... If statements within a single set of pages to
> execute GET or POST, depending on a browser test?
> 
> Or...simply use a browser test and then request/require users to turn
> on cookies to proceed, and use a single pure set of pages that
> require session cookies?
> 
> Jonathan

Er, you've lost me. There's nothing to do, that's the beauty of it! The PHP
install on the server determines which way to go. You've just got to make
sure that you're instantiating your session with session_start() at the top
of each page. All your session variables will work as advertised either way
- PHP propagates only the session ID via GET, and only when it has to. If
it's available from the client's session cookie, all good, otherwise it'll
pass it around via the URL.

So, for example, $_SESSION['user_name'] will always work. Since you have to
test for it anyway, you can always redirect to a page on fail that outlines
the need for cookies to be enabled.

Sorry if you've already understood this and I'm just not understanding you!

-- 
Kevin Futter
Webmaster, St. Bernard's College
http://www.sbc.melb.catholic.edu.au/



------------------------------------------
This e-mail and any attachments may be confidential.  You must not disclose or use the information in this e-mail if you are not the intended recipient.  If you have received this e-mail in error, please notify us immediately and delete the e-mail and all copies.  The College does not guarantee that this e-mail is virus or error free.  The attached files are provided and may only be used on the basis that the user assumes all responsibility for any loss, damage or consequence resulting directly or indirectly from the use of the attached files, whether caused by the negligence of the sender or not.  The content and opinions in this e-mail are not necessarily those of the College.





More information about the FX.php_List mailing list