I am writing a counter that is created on the fly using GD::Image. I am running into a problem with setting a cookie to ensure that the same user is not counted more than once, as I wish to only count unique hits. The problem is setting the cookie. I am not sure if it is possible to print out more than one header in a script, but since the cookie requires sending a header, and the image requires sending a header, there is a real problem here. Can anyone advise me on how to accomplish this?

Recommended Answers

All 2 Replies

You should be able to do both in one header because the cookie is not a content-type entity. I am not real experienced with cookies but maybe if you post your code I can help, or maybe someone else can.

Don't know if you really need much more than this.
Here is header line for GD declaring content type: print header('image/gif'); Here is header line for setting cookie "$cookie": print header(-cookie=>$cookie);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.