Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE development pitfall with cookies/sessions

Status
Not open for further replies.

mynameisdan

Programmer
Jan 14, 2005
2
GB
Hi, I was just about to ask for help with a problem concerning session cookies, PHP and IE6 (on PC, Win XP SP2), then I stumbled on the answer and thought I would pass it on.

The problem was that I want to force the use of cookies for session (is more secure). To do so you need a reliable way of finding out if cookies are being used to propogate sessions. A good way seemed to be to call session_start() and then check if the string 'SID' was a blank string or not. In theory it will be blank if cookies are being used, therefore no need to promt the user to turn them on. It all worked except in IE6, where it worked the first time and then failed to work any time after - ie. a cookie was being set despite the brower options being set not to allow this.... After some time cursing Bill Gates I decided to put it online and test it there rather than test it locally using IIS/localhost. Shazzam! it works.

I hope this tip will save you some time cursing Bill Gates, but give him one anyway for all his flakey software :)

PS it's a new spring in the UK, and all the programmers are blinking in the sunlight - happy days to all!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top