I need an alternating (image) script (that i will use for alternating banners on a site) Second one a posting article script with a simple control panel . Thanks in advance
$rand = rand(1,3); if ($rand == "1"){echo "banner 1";} if ($rand == "2"){echo "banner 2";} if ($rand == "3"){echo "banner 3";} PHP: Thats a simple one
I appreciate that you may not want something quite as involved, but if you're looking to carry ads, you might want to look at PHPAdsNew (an open source ad server).
Here's one I use: <?php $files=glob("ads/*.txt"); $picks= array_rand($files,1); include $files[$picks[0]]; ?> Code (markup): Randomly pick's an ad file out of a directory and includes it on a page. It's a little better than the above approach.