> So what's the flow of code to test for cookies on the server 
> side?  I'm
> pretty sure that the only way is to set a cookie, then test for it.

That is pretty much it. On the first page request to your application, if
PHP encounters a session_start() in your code, it will return a cookie named
PHPSESSID in the response headers. So you need to look for that cookie in
the request for the *second* page. If cookies are enabled in the browser,
the browser will return the cookie in the next request. Here's some code to
put at the top of the 2nd page:

function check_cookies() {
    global $HTTP_COOKIE_VARS;
        header("Location: ./cookie_error.php");

I usually make my index.php page just set up the session, etc., then do an
automatic redirect to my second page, which is the first visible page. I put
the cookie check on this second page.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to