#!/usr/bin/perl # ------------------------------------------------------------------------- # idio-audio-links.cgi - Based on www.syntac.net/idio-audio/links.html # 1. Please make sure that the control structure is not altered. # 2. Save the edited file in text form. # 3. Transfer this file to the WWW server in ASCII mode. # 4. Set its protection to world read, execute (e.g. chmod 755 filename) # ------------------------------------------------------------------------- # (To see if the script works as intended: Type 'thisfile.pl < test', where test is a text file containing # the item identifiers as, Item1=string&Item2=string&Item3=... # Alternatively, you may like to install the CGI and HTML and test via the form.) # ------------------------------------------------------------------------- # ------------------------------------------------------------------------- # Start of the Perl script: # ------------------------------------------------------------------------- # Procedure to send mail sub do_mail { local($filename) = "/tmp/cf-$$"; open(TFILE,">$filename"); # >>>>> Start of User configurable section 1 of 2 >>>>> # The mail subject will be at the top of the message. print TFILE "**************************************************\n"; print TFILE "Title: Suggested URL for the IDIO-AUDIO Links Page\n"; print TFILE "**************************************************\n\n"; if ($url ne "") { print TFILE "url: $url\n"; } close(TFILE); `/usr/bin/mail $mailreceiver < $filename`; $mailstatus = $?; unlink("$filename"); } # <<<<< End of User configurable section 1 of 2 <<<<< # >>>>> Do not alter anything in the following section >>>>> # convert %20 to a space and other %dd to a character sub reformat { local($tmp) = $_[0] ; $tmp =~ s/\+/ /g ; while ($tmp =~ /%([0-9A-Fa-f][0-9A-Fa-f])/) { $num = $1; $dec = hex($num); $chr = pack("c",$dec); $chr =~ s/&/and/g; # Replace if it is the & char. $tmp =~ s/%$num/$chr/g; } return($tmp); } # Main body of the script sub do_main { $cl = $ENV{'CONTENT_LENGTH'}; if ($cl > 0) { read(STDIN, $_, $cl); $_ .= "&"; # Append an & char so that the last item is not ignored $pquery = &reformat($_); while ($pquery =~ /url=([^&]*)&/) { if (!$url) { $url = $1; } else { $url = $url."\n ".$1; } $pquery =~ s/url=([^&]*)//; } $url = &reformat($url); # <<<<< Do not alter anything in the above section <<<<< # >>>>> Start of User configurable section 2 of 2 >>>>> print "Content-type: text/html\n\n"; print "
\n\n";
print "IDIO-AUDIO\n";
print "
\n";
print "Independent And Experimental Music Online
\n"; print "\n"; print "\n"; print "º010010010100º
\n"; print "\n"; print "\n"; print "
Acknowledgement
\n"; print "Thank you for your participation.
Your Suggested URL has been accepted for our concurrence.
\n"; print "The following data has been sent to IDIO-AUDIO.
\n"; print ""; if ($url ne "") { print "URL: : $url\n"; } print ""; print "
\n"; &do_mail; print "Sent at $misterwolf from $ENV{'REMOTE_HOST'}
\n"; if ($mailstatus == 0) { print "Transmission Successful!
\n"; } else { print "
\n"; print "The error status was $mailstatus).\n"; } print "
º010010010100º
«startlistenreadjoinwitnessstop»
.
.
.