home *** CD-ROM | disk | FTP | other *** search
- #!/user/a61/perl/bin/perl
- # #!/usr/local/bin/perl
-
- $postcard_file = "postcard.html";
- $picture_dir = "../pictures/";
- $begin = "Begin";
- $end = "End";
- $file_error = "Cannot open file";
-
- $extension = ".gif";
- @postcards = (
- postcard_01,
- postcard_02,
- postcard_03,
- postcard_04,
- postcard_05,
- postcard_06,
- postcard_07,
- postcard_08,
- postcard_09,
- postcard_10,
- postcard_11,
- postcard_12,
- postcard_13,
- postcard_14,
- );
-
- # Read arguments from command line
-
- if ($#ARGV == 0) {
- $arg = @ARGV[0];
- # if ( !($arg eq "Greetings" || $arg eq "Merry" || $arg eq "Happy") ) {
- # print "Usage: flower.cgi [Greetings|Merry|Happy]\n";
- # exit(0);
- # }
- }
- else {
- # print "Usage: flower.cgi [Greetings|Merry|Happy]\n";
- exit(0);
- }
-
-
- # Read the file
- #
- if (!open(P_FILE, $postcard_file)) {
- print "$file_error: $postcard_file\n";
- exit 0;
- }
- else {
- @data_list = <P_FILE>;
- }
- close(P_FILE);
-
-
- # Process database
- #
- $status=0;
- foreach $data_entry (@data_list) {
- if ($data_entry =~ /$begin/) {
- foreach $postcard (@postcards) {
- push (@entry, "<tr>\n");
- push (@entry, "<!-- Begin Postcard -->\n");
- push (@entry, "<td bgcolor=\"#FFFFFF\" align=\"center\" valign=\"top\">\n");
- push (@entry, "<a target=\"preview\" href=\"preview.cgi?$arg+$postcard\"><img src=\"$picture_dir/$postcard$extension\" border=\"0\"></a>\n");
- push (@entry, "</td>\n");
- push (@entry, "<!-- End -->\n");
- push (@entry, "</tr>\n");
- }
- $status=1;
- }
-
- if ($status == 0) {
- push (@entry, "$data_entry");
- }
- else {
- if ($data_entry =~ /$end/) {
- # push (@entry, "$data_entry");
- $status=0;
- }
- }
- }
-
-
- # HTML output
- #
- print "Content-Type: text/html \n\n";
- foreach $entry (@entry) {
- print "$entry";
- }
-