#!/usr/bin/perl -w # randpic.cgi - read a directory to find the pictures; redirect browser to show # a random one of them use strict; # configuration my $basedir = '/home/daniel/public_html/flgc/photos/'; my $baseURL = 'http://vaio/~daniel/flgc/photos/'; unless (`hostname` =~ /vaio/) { $basedir = '/home/flgbtqc/www/photos/'; $baseURL = 'http://flgbtqc.quaker.org/photos/'; } my @files = (<$basedir*jpg>,<$basedir*png>,<$basedir*gif>); srand; my $pic = $files[rand @files]; $pic =~ s|.*/||; print "Status: 302 Moved\nLocation: $baseURL$pic\n\n";