mandn.cgi
#!/usr/bin/perl @pairs = split(/&/, $ENV{'QUERY_STRING'}); foreach $pair (@pairs) { ($key, $value) = split (/=/, $pair); $key =~ tr/+/ /; $key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~s/<!--(.|\n)*-->//g; if ($formdata{$key}) { $formdata{$key} .= ", $value"; } else { $formdata{$key} = $value; } } print "Content-type: text/html\n\n"; $phone = $formdata{'phone'}; if ($phone =~ /^((\(\d{3}\))? *\d{3}-\d{4},? *)+$/) { print "You entered the phone number(S) <B>$phone</B>"; } else { print "Please enter the phone number(s) in the form <P>(123) 456-7899<P>(The area code is optional.)"; }