home *** CD-ROM | disk | FTP | other *** search
- #!/user/a61/perl/bin/perl
- # #!/usr/local/bin/perl
-
- $input_error = "Cannot process input";
- $file_error = "Cannot open file";
-
- $form_password = "password";
-
- $dir = "../postcards/";
- $extension = ".html";
-
- # Read CGI input
- # split pairs in variables.
- #
- read (STDIN, $input, $ENV{'CONTENT_LENGTH'});
- @pairs = split (/&/, $input);
- if (scalar(@pairs) == 1) {
- foreach $pair (@pairs) {
- ($attribute, $value) = split (/=/, $pair);
- $value =~ tr/+/ /;
- $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
-
- if ($attribute eq $form_password) {
- $password_input = $value;
- }
- }
- }
- else {
- print "$input_error\n";
- exit 0;
- }
-
-
- $file = $dir.$password_input;
- $file = $file.$extension;
- if ( !(-e $file) ) {
- print "Location: try_again.html\n\n";
- }
- else {
- print "Location: $file\n\n";
- }
-