in reply to setting a cookie via an image

You are forgetting the Content-Type: image/gif header. I don't know if that is relevant. binmode FILE is also a good idea, though not relevant. It may simply be that the browser is dropping the headers when img is called from a page.

It rather begs the question - why aren't you just setting the cookie when the main page loads. This sort of stuff usually makes me think spyware.

cheers

tachyon

Replies are listed 'Best First'.
Re^2: setting a cookie via an image
by jonnyfolk (Vicar) on Aug 28, 2004 at 11:33 UTC

    In the original question I stated that I needed a conditional to check if the information is already there - otherwise reloading the page would overwrite the original information. there is nothing sinister about it at all.

    Why do I need the information? A lot of users to that page are referred and I need to keep track of where they came from. But if they take a look around the site and reload that page then the original information is lost as a new cookie is set

    I added the header but it didn't make a difference - thanks anyway

      It sounds like you simply have a broken implementation of intrasite user tracking. The usual logic is:

      if ! tracking_cookie make new session ID log referer, browser, blah as initial data add entry page to track log for session ID send cookie with session ID when returning page else add page to track log for session ID

      Once you have set a cookie (with a session ID) reloading a page will still send that cookie to you provided the path is correct.

      cheers

      tachyon