#!/usr/local/bin/perl -- -*- C -*- # add-name - add your name to my visited person list # by eto kouichirou $list = "/seed/WWW/eto/person-list"; #$list = "./list"; open(LIST, ">>$list") || die "Can't open list."; $goback = " Go back to the list.\n"; $myaddress = "
ETO Kouichirou <t91069ke@sfc.keio.ac.jp>
\n"; &cgi'header; print "Add your name to my Visited person list! (submit)\n"; &cgi'decode; foreach $tag (keys(%cgi'tags)) { $cont = $cgi'tags{$tag}; $cont =~ s/&/&/g; $cont =~ s//>/g; if ($tag eq "name") { $name = $cont; } if ($tag eq "address") { $address = $cont; } if ($tag eq "url") { $url = $cont; } } if ((!defined($name)) || ($name eq "")) { print "

Your addition is failed.

\n"; print "Because name is missing.

\n"; print $goback . $myaddress; exit 0; } elsif ((!defined($address)) || ($address eq "")) { print "

Your addition is failed.

\n"; print "Because address is missing.

\n"; print $goback . $myaddress; exit 0; } elsif ((!defined($url)) || ($url eq "")) { $output = "

  • " . $name . " <" . $address . ">\n"; } else { $output = "
  • " . $name . " <" . $address . ">\n"; } print "

    Thank you for your adding your name to my list!

    \n"; print "This is the your addition.

    \n"; print "

    \n"; print $goback . $myaddress; exit 0; # cgi.pl - decode CGI input. # by ETO Kouichirou # date 1994/05/11 # # Usage: # # require 'cgi.pl'; # &cgi'decode; # ... # $name = $cgi'tags{'name'}; package cgi; sub header {print "Content-type: text/html\n\n";} sub decode { local($args, $n_read, *terms, $tag, $value); if ($ENV{'REQUEST_METHOD'} eq "POST"){ $n_read = sysread(STDIN, $args, $ENV{'CONTENT_LENGTH'}); } else { $args = $ENV{'QUERY_STRING'}; } @terms = split('&', $args); foreach (@terms) { ($tag, $value) = split(/=/, $_, 2); $value =~ s/\+/ /g; $value =~ s/%(..)/pack("c", hex($1))/ge; $tags{$tag} = $value; # tags is global } } 1;