in reply to location of header thats setting a cookie

It's difficult to say what your problem is without a code sample; it sounds to big to post, here, though. However, I can say that header must be printed before any other output from the program. If you are printing something else to STDOUT first, header won't do its job.

Update: Shucks, syn beat me to the punch! :)