home *** CD-ROM | disk | FTP | other *** search
/ Internet 1996 World Exposition / park.org.s3.amazonaws.com.7z / park.org.s3.amazonaws.com / Postcards / send / postcard.cgi < prev    next >
Encoding:
Text File  |  2017-09-22  |  1.8 KB  |  90 lines

  1. #!/user/a61/perl/bin/perl
  2. # #!/usr/local/bin/perl
  3.  
  4. $postcard_file = "postcard.html";
  5. $picture_dir = "../pictures/";
  6. $begin = "Begin";
  7. $end = "End";
  8. $file_error = "Cannot open file";
  9.  
  10. $extension = ".gif";
  11. @postcards = (
  12.    postcard_01,
  13.    postcard_02,
  14.    postcard_03,
  15.    postcard_04,
  16.    postcard_05,
  17.    postcard_06,
  18.    postcard_07,
  19.    postcard_08,
  20.    postcard_09,
  21.    postcard_10,
  22.    postcard_11,
  23.    postcard_12,
  24.    postcard_13,
  25.    postcard_14,
  26. );
  27.  
  28. # Read arguments from command line
  29.  
  30. if ($#ARGV == 0) {
  31.    $arg = @ARGV[0];
  32.    # if ( !($arg eq "Greetings" || $arg eq "Merry" || $arg eq "Happy") ) {
  33.       # print "Usage: flower.cgi [Greetings|Merry|Happy]\n";
  34.       # exit(0);
  35.    # }
  36. }
  37. else {
  38.    # print "Usage: flower.cgi [Greetings|Merry|Happy]\n";
  39.    exit(0);
  40.  
  41.  
  42. # Read the file
  43. #
  44. if (!open(P_FILE, $postcard_file)) {
  45.    print "$file_error: $postcard_file\n";
  46.    exit 0;
  47. }
  48. else {
  49.    @data_list = <P_FILE>;
  50. }
  51. close(P_FILE);
  52.  
  53.  
  54. # Process database
  55. #
  56. $status=0;
  57. foreach $data_entry (@data_list) {
  58.    if ($data_entry =~ /$begin/) {
  59.       foreach $postcard (@postcards) {
  60.           push (@entry, "<tr>\n");
  61.           push (@entry, "<!-- Begin Postcard -->\n");
  62.           push (@entry, "<td bgcolor=\"#FFFFFF\" align=\"center\" valign=\"top\">\n");
  63.           push (@entry, "<a target=\"preview\" href=\"preview.cgi?$arg+$postcard\"><img src=\"$picture_dir/$postcard$extension\" border=\"0\"></a>\n");
  64.           push (@entry, "</td>\n");
  65.           push (@entry, "<!-- End -->\n");
  66.           push (@entry, "</tr>\n");
  67.       }
  68.       $status=1;
  69.    }
  70.  
  71.    if ($status == 0) {
  72.       push (@entry, "$data_entry");
  73.    }
  74.    else {
  75.       if ($data_entry =~ /$end/) {
  76.          # push (@entry, "$data_entry");
  77.          $status=0;
  78.       }
  79.    }
  80. }
  81.  
  82.  
  83. # HTML output
  84. print "Content-Type: text/html \n\n";
  85. foreach $entry (@entry) {
  86.    print "$entry";
  87. }
  88.