> I'm wondering if anyone has found or ended up
> writing something similar to
> the MSWC AdRotator object in ASP, but for PHP?  Or
> is there already a module
> on apache.org that I missed?

(Figre I should pull my weight on this list here.)

Hmm. Not sure exactly what MSWC AdRotator is, but
here's one I developed. Is it what you want? It checks
a specific directory and grabs a random file from that
directory, then displays it.

if($file = GetRandomPicture($BannerAdsDirectory)) {
        $seriescode = substr($file, 0, 2);
        print("               <A HREF = \"URL.html\"><IMG SRC
= \"$BannerDirectory/$file\" WIDTH =
\"$banneradswidth\" HEIGHT = \"$banneradsheight\"
BORDER = \"0\"></A>\n");

function GetRandomPicture($sourcedirectory) {
        if($directory = @opendir($sourcedirectory)) {
                while($file = @readdir($directory)) {
                        if(($file != ".") && ($file != ".."))
                                $files[count($files)] = $file;
                $randomfile = rand(0, count($files) - 1);
                $returnvalue = $files[$randomfile];
        } else {
                $returnvalue = NULL;

        return $returnvalue;

If anyone can improve on it, let me know. Thanks to
the two guys who posted the links, though. I'll be
sure to check them out once I get a couple of minutes
of free time.


Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to