Bo Larsson's Internet Server Software

Bo Larsson's Internet Server Software
All Contents Copyright 1997-2020 by Bo Larsson - Send questions or comments to:
Table of Contents
Last updated 18 Jan 97

Perl CGI Scripts

guestbook 970118 NEW!
classifieds 970115 NEW!
search 961211
table 961201
textrotate 961121
rotater 961119
navigate 961117
redirect 961111
pcounter 961110
mailsend 961110
yourhost 961110
youraddress 961110

Java Applets

jclock 961204 NEW!
jcounter 961114

Links to Other Sites

Fisher's CGI Talk NEW!
JemTek CGI C Library
Dream Catchers CGI Scripts
Web Engineer's Toolbox Home Page
Common Gateway Interface
CGI Made Really Easy
CGI Programmer's Reference
Matt's Script Archive
Netamorphix CGI Page
Selena Sol's Archive

rotater 961119

view the source

show me an example

show me the html source for the example

Have you ever wanted to display a selected graphic from a directory each time a person visited your page? And have you wanted the graphic to rotate for each visit? Have you wanted all graphics in the directory to be displayed before repeating? There are a few random graphic scripts out there, but their major failing is the fact that they cannot guarantee that all graphics will be displayed an equal number of times. The rotater script comes to the rescue!

What it does

The rotater script basically returns the next file in a specified directory. It keeps track of the last file name it returns, and makes sure to return the next file in the list. If it has reached the last file in the directory, it returns the first file, and increments from there.

What's it good for

Say for example that you run a really popular web site, and you want to offer banner advertising to your sponsors. Say also that you want each banner to be displayed on your main page an equal number of times. How do you do this? Check out the example given here. It will show you how by using the rotater script. By the way, you'll need server side includes to do the same thing as demonstrated in this example.