You cannot detect if cookies are enabled with a single operation. You must
write to a cookie in one script, then test for that cookie in a second
script.
PHP sessions can work even if the target browser does not allow cookies,
permanent or session-temporary, using a technique known as URL rewriting.
Read the manual at
http://www.php.net/manual/en/ref.session.php for details.
--
Tony Marston
http://www.tonymarston.net
"Tom" <Tom@nospam.com> wrote in message
news:41444afb$0$20250$cc9e4d1f@news-text.dial.pipex.com...[color=blue]
> Hi,
>
> I would like to use the standard PHP sessions and I understand they rely
> on the target web browser to support session cookies.
>
> I have tried the following code:
>
> <?
> session_start();
> if (!session_id()) { //no support for session
> header("Location: nocookie.php");
> exit();
> } else { //session open
> ...
> }
> }
>
> echo "cookie ok, user logged as ".$_SESSION['uid'];
>
> ?>
>
> I wanted to reroute the user to a "nocookie" page (advice page) if their
> web browser does not support cookies, but it does not seem to work, even
> if I put IE in the hightest privacy settings.
>
> I know PHP can also use the URL to maintain sessions, but this does not
> work very well in my experience.
>
> Any ideas on how to detect no support of session cookies, on one single
> page?
>
> Thanks,
> Tom
>[/color]