I would suggest sending a list of other ads as JSON, and then using JS to swap it. You could do that with a setInterval
. This is a little bit trickier without jQuery, do you have any other libraries on the site?
For the PHP, add
$ads_json=json_encode($banners);
underneath where you declare the $banners array.
Change your banner element to have an ID so we can access it via JS easily.
$randombanner = '<a id="sponsor_banner" href="'.$href.'" target="_blank" alt="example.com Sponsor!" title="example.com Sponsor!"><img border="0" src="'.$src.'" /></a>';
Then add to the $randombanner html...
<script>
var ads='.$ads_json.';
function swap_ad(){
var ad_el=document.getElementById("sponsor_banner");
var img=ad_el.getElementsByTagName('img')[0];
var random_ad=ads[Math.floor(Math.random()*items.length)];
ad_el.href=random_ad["href"];
img.src='.$path.'random_ad["src"];
};
window.setInterval(swap_ad,90000000);
</script>
It would be nice to put the script in the head. Putting it by the element will work though, not sure about the limitations of vBulletin.