#!/usr/bin/perl
#
#
#
#
#
# Warning WARNING Warning WARNING Warning
#
# This is not the file you want to edit.
#
# the original can be found at:
# /afs/csail.mit.edu/u/g/gremio/public_html/pics
#
#
#
#
#
#
#
#
#
#
#
#
use strict;
use File::Basename;
use Cwd;
$|=1;
#< deny
my %deny = ("65.75.152.120" => 1,
"66.111.215.196" => 1
);
if (defined $deny{$ENV{REMOTE_ADDR}}) {
exit 0;
}
#>
my $diricon = "/~gremio/icons/directory.jpg";
my $logdir = "/afs/csail/u/g/gremio/public_html/pics/.log/";
my $default_height = 300;
my $lighterPrefix = ".l-";
# Standard CGI stuff: $debug, debug_info(), space(n)
#< htesc(str), uriesc(str), a/url_button(uri,str,opts)
use Data::Dumper;
use CGI qw/:all/;
print header;
use CGI::Carp qw(fatalsToBrowser);
my $input= new CGI;
$input->import_names('in');
my $debug = $in::debug if (defined $in::debug);
#< Postgres -- commented out --
# use Postgres;
my $conn;
# if (defined $database and $database ne "") {
# $conn = Postgres::db_connect($database)
# or die "could not connect -- $Postgres::error";
# }
#>
#< htesc (text)
sub htesc {
my $text = shift;
$text =~ s/\&/&/g;
$text =~ s/\</g;
$text =~ s/\>/>/g;
# $text =~ s/\'/'/g;
$text =~ s/\"/"/g;
$text =~ s/([^\s\x20-\x7e])/sprintf("\&%x;", ord($1))/ge;
$text =~ s/\n/
\n/gs;
$text =~ s/\t/&space(8)/ges;
$text =~ s/ /&space(1)/ges;
return $text;
}
#>
#< uriesc (text)
sub uriesc {
my ($url) = @_;
my ($olink) = ($url =~ /\?(.*)$/);
my $link = $olink;
foreach my $badchar ($link =~ /([^\w=&:;+\.])/g) {
my $goodchar = sprintf "%%%x", ord($badchar);
$link =~ s/\Q$badchar\E/$goodchar/g;
}
$url =~ s/\Q$olink\E$/$link/;
return $url;
}
#>
#< a (url, text [, %options])
sub a {
my ($url, $text, %options) = @_;
$url = uriesc($url);
my $link = qq($text);
return $link;
}
#>
#< space(n): return n HTML non-breaking spaces
sub space {
my ($n) = @_;
my $s="";
$n=1 unless $n;
$s .= "\n";
for (my $i=0; $i < $n; $i++) {
$s .= " ";
}
$s .= "\n";
return $s;
}
#>
#< debug_info() some environment info for debugging
sub dUmper {
my $varstr = shift;
use Data::Dumper;
my $string = Dumper(@_);
$string =~ s/^\$VAR1/$varstr/;
return htesc $string;
}
sub debug_info {
return unless $debug;
my %options = @_;
print "\n"; #NOTE: required if you haven't printed anything yet!!!
my ($cpack, $cfile, $cline) = caller();
print qq(
$titleEOH ; &button_bar(); print <<"EOH"; |
| );
print qq(What is your name?);
print qq( ); print qq(Would you like a response? If so, how may I reach you? ); print qq( ); print qq(Do you have overall comments about this album? ); print qq( ); print qq(May I share your feedback with other readers?); print qq( Yes. ); print qq(Thanks again for your comments! ); print qq(); print qq( |
$titleEOH ; &button_bar(); print <<"EOH"; |