The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Cookie Detection (On|Off) in Browser?

Ok, I know this is easy to do with javascript but I need to know if cookies are enabled or not before sending the headers. Basically I need to know how to start my sessions based on wether cookies are enabled or not.

I'm building a user management system that's going to use a session.class to handle user sessions through a database but the session $id still needs to be passed from page-to-page. Now I have Trans_ID truned off because search engines can't/won't traverse links with (?) in them so if cookies are off I have no way to carry the seesion id through the site. My solution is to the have a class which, upon detection of cookies being disabled, can then set-up a session_set_save_handler() to use an ID based on the users IP, browser and http_referrer strings to make a unique id for them. I know that ip based auth can be a problem for people behind proxies so I figure with the browser AND referrer strings as well as the fact it's only done this way with coookies being off should keep the possibility of transfered sessions to almost nonexistent (user would have to have the cookies off,the same IP(possible if behind a proxy) the same exact browser and version, and have come from the exact same page as another.... maybe something more can even be add to make it even more probable?).

So this is why I need to know the state of cookies in the browser. I would like to avoid having to use serveral pages to do the detection like I've seen suggested elsewhere. My site uses variables set in the sessions to produce elements on my site so it's very difficult to do with javascript... or is it? How would I pass the javascript var to php without lodaing the body of the page?