954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

If page loads certain image, display message, otherwise different message

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 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?

cpappas
Newbie Poster
2 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

You would need JavaScript for this, not PHP.

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

Kieran :)

Kieran Y5
Junior Poster
137 posts since Aug 2010
Reputation Points: 18
Solved Threads: 18
 

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 !

P0lT10n
Posting Whiz in Training
235 posts since Apr 2010
Reputation Points: 13
Solved Threads: 30
 

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.

richieking
Master Poster
764 posts since Jun 2009
Reputation Points: 61
Solved Threads: 152
 

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 :)

Kieran Y5
Junior Poster
137 posts since Aug 2010
Reputation Points: 18
Solved Threads: 18
 

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.

richieking
Master Poster
764 posts since Jun 2009
Reputation Points: 61
Solved Threads: 152
 
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.

cpappas
Newbie Poster
2 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: