PDA

View Full Version : Simple Banner Rotation script not working


ScottG
11-20-2002, 10:33 PM
I just want a simple way to cycle 4 different banners linking to other websites for my site. I found this script "banlink.cgi" and it doesn't work right. So far I have only gotten two banners to show up but mostly it doesn't cycle.

Any ideas or is there some other easy way for me to accomplish this. Maybe with Javascript?

Here is the script and below is how I call it.

#!/usr/bin/perl
$|=1;
$mypic[0]="/images/tbanner0.gif WIDTH=400 HEIGHT=40";
$myurl[0]="http://www.amazon.com";
$mypic[1]="/images/banner1.gif WIDTH=400 HEIGHT=40";
$myurl[1]="http://www.yahoo.com";
$mypic[2]="/images/banner2.gif WIDTH=400 HEIGHT=40";
$myurl[2]="http://www.cnn.com";
$mypic[3]="/images/banner3.gif WIDTH=400 HEIGHT=40";
$myurl[3]="http://www.foxnews.com";
srand(time ^ $$);
$pick = rand(@mypic);
print "Content-type: text/html\n\n";
print "<A HREF=\"$myurl[$pick]\"> <IMG SRC=$mypic[$pick]></A>";
------------------------------------
<!--#exec cgi="/cgi-bin/banlink.cgi" -->


Help please!!

ScottG
11-20-2002, 11:07 PM
I just noticed that it does seem to cycle but I have to wait about 2-3 minutes before refreshing the page.
Does that make sense? So I guess never mind.