• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

PHP: random banner rotator problem

Agum

New Member
Hi,
I'm trying to write a banner rotator script in PHP, one that doesn't use SSI to call or include() in a php script or anything.
In other words, the way I want it to work is basically like WebAdverts back then (for perl), where you would include a static HTML on a regular HTML page like:
Code:
<a href="http://www.mysite.com/bannerlink.php?pageid=123&whateverelse"><img src="http://www.mysite.com/bannerdisplay.php?pageid=123&whateverelse"></a>
However, I now need a way to correspond the clicking of a certain banner correctly with the banner that was displayed.
I'm thinking about using cookies to achieve this. but I would still need to include some sort of page ID that is different for every page that displays the banner, would I? is there any way I can have one piece of static code on all pages? also, even if I use page IDs, if a user goes to a page, then open a new window and go to that page again and a new banner is displayed, clicking the banner on the first window would still redirect to the wrong link, wouldn't it?
What is a good solution to this problem?
Please don't suggest the use of SSI or include() because the situation doesn't allow for it.

Thanks!
 
I just thought of using iframes. This would solve problems as I can then have only one piece of static HTML code on all pages and still have banners rotate AND link to the right URLs easily without keeping track of many things.
But are there any other ways? older netscape does not support iframes. not that that many users use it.. but still. I would prefer it if I can do it in a simple a href img.
 
You can use ilayer which was supported by the 4.x Netscape browsers. You would then put your iframe tag inside of the nolayer tags. Only the older Netscape browsers support ilayer, so for everyone else it will default to the nolayer tag which has your iframe in it.

ex.
Code:
<nolayer><iframe src="whatever.html"></iframe></nolayer>
<ilayer src="whatever.html"></ilayer>
 
Back
Top