Here is a script i use. I called it random.php and created another file called banners.txt This is already set up to open in a new window and displays new banner when screen refreshes. Just call the random.php file were you want your banners

random.php
Code
<?

// Generate random microtime
@srand((double)microtime()*1000000);


// This is the main function that displays the banner
function banner($select, $host, $host2)
{
// This variable lets us know that we have now attempted to display a banner
$attempted = true;

// This variable reads the banners.txt file contents
$lines = @file("http://www.path/to/banners.txt");

// This variable counts the number of lines in the banners.txt file
$count = @count($lines);

// This variable selects a random line number
$random = @rand(0,$count-1);

// This variable sets our randomly selected banner
$selected = $lines[$random];

// This variable separates the image and URL from each other
$pieces = @explode(",", $selected);


/* Make sure we don't attempt to display a banner
more than $max_attempts times (prevents an infinite loop).
If you do, you need to add banners to your
banners.txt file */

$max_attempts = 200;

$attempts = 0;

	// Check to be sure the banner is not for this web site
	// If it is, recall the function for another banner

	IF ($host == $pieces[0] AND $attempts <= $max_attempts OR $host2 == $pieces[0] AND 		$attempts <= $max_attempts) {
	++$attempts;
	banner ("display", $host, $host2);
	}

	/* This displays the banner if one is present.
	If more than 3 attempts are tried, it will be
	Displayed regardless of whether or not it is
	for this web site. */

	ELSE {
echo ("<center><A HREF=\"$pieces[0]\" TARGET=\"new\"><IMG SRC=\"$pieces[1]\" BORDER=0></A></center>");	}

}

// Grab our current host name
$host = "http://" . $_SERVER[HTTP_HOST];

// Remove the "www." from the host name
$host2 = str_replace("www.","",$host);

// If we haven't tried to display a banner, do it now
IF (!isset($attempted))
{
banner ("display", $host, $host2);
}

?>

banners.txt
repeat on separate line for each site
Code
http://www.website.com,http://www.website.com/path to/banner image