Forum Moderators: DixonJones

Message Too Old, No Replies

cookie help

beginner neeeds help with cookies...

         

Kevin_77006

2:00 pm on Feb 1, 2005 (gmt 0)



Ok, I apologize if this seems like a really dumb question....
that being said, I need some help/advice:
We would like to be able to offer visitors to our website a free gift in exchange for taking the time to visit the different areas of our site.
Is it possible to give visitors a different cookie when they visit each area, and then allow them to go to a page to sign up for their free gift once they have visited all three areas of the site? (and NOT allow them to go to the sign-up page if they dont have the proper cookies?)

If this IS possible, then how would I go about doing it?
If its NOT possible, any suggestions on achieving the same results?

andye

2:20 pm on Feb 1, 2005 (gmt 0)

10+ Year Member



Yes. :)

Definitely possible. Of course it won't work if the user has cookies switched off - most people don't, but you might want to add an FAQ about that.

How to set and read cookies - either:
1) server-side (in which case it depends on which programming language you're using) or
2) client-side, with Javascript. The Javascript book published by O'Reilly has (AFAIR) a decent explanation of how to do this. This won't work if the user has Javascript switched off, of course.

NB
Server-side = on your web server
Client-side = in the visitor's browser
Of course the cookie itself is always set in the user's browser - but your web server is able to manipulate the cookie values remotely (which is the whole point of cookies).

A 'gotcha' to watch out for: P3P privacy policies and IE6. Once you've got it working basically, check that IE6 isn't blocking your cookies - if it is then you need to find out about P3P.

HTH, and best wishes,
A.