Hey,

So I am using PHP although any language solution would be great. I am looking at displaying whether or not a cookie from a specific ad network is present on your web browser. A good example is with AdChemy. They are a part of the NAI (Network Advertising Initiative) so by going to http://alps.adchemy.com/alps-cs/auuid/nai-status that page will redirect you to either http://www.networkadvertising.org/verify/cookie_optout.gif if you have opted out of their network or http://www.networkadvertising.org/verify/no_cookie.gif if no cookie is present or http://www.networkadvertising.org/verify/cookie_exists.gif if they have a cookie on you.

I want to be able to load the <img src="http://alps.adchemy.com/alps-cs/auuid/nai-status" /> and depending on which image loads it will display the word Cookie, No Cookie, or Opted out. Does anybody know how I would even go about doing this?

Recommended Answers

All 6 Replies

You would need JavaScript for this, not PHP.

I'm no expert at JavaScript so I can't really help on that part.

Kieran :)

Member Avatar for P0lT10n

If i am right like Kieran, you will have to use JavaScript, because you are able to "read/use" options of your browser, and then, find that cookie and then print what you want... i cant help you too... but it wont be hard to do it !

ITS possible with php and perl too.

you must have a session cookie check on your page and you do a header location.

Let me now if you want more info and i will assist.

ITS possible with php and perl too.

you must have a session cookie check on your page and you do a header location.

Let me now if you want more info and i will assist.

You *could* do that but you couldn't do it on the same page. You could put an image on the page and then (on the same page) moan about it not loading. You would have to refresh/change page to detect it.

YOU WOULD STILL NEED JAVASCRIPT!

Kieran :)

IT can be done fully on php. I just checked on the links up there. If that is what he wanted, trust me php will do that. very easy script.

Read what he want to do very well. cookie redirection based on cookie set and active or not.

The best way to solve a problem is understanding.

Explore :)

This is session cookie with long life, On the top of the page . Read session file and if it exist, show a page or Image.

If it not, then a different IMAGE is displayed plus set the session cookie on the system. And then another image based on results etc...

cpappas can you confirm if this is what you wanted. I will write you this 20 lines script.


cpappas can you confirm if this is what you wanted. I will write you this 20 lines script.

Yes, this is exactly what I am looking for. If you could help guide me in the correct direction that would be great.

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.