#!/usr/bin/perl # This is a CGI script to do a name search of the oanda database. # It is to be installed at /web/herald/htdocs/heraldry/OandA/oanda_name.cgi on atensubmissions.nexiliscom.com. # Set URL for this script. $cgi_url = '/cgi-bin/heraldry/OandA/oanda_name.cgi'; # Set title for form. $form_title = 'Name Search Form'; require '/web/herald/cgi-bin/heraldry/OandA/common.pl'; # Process arguments. foreach $pair (split (/\&/, $ENV{'QUERY_STRING'})) { ($left, $right) = split (/[=]/, $pair, 2); $left = &decode ($left); $right = &decode ($right); $p = $right if ($left =~ 'p'); } &print_header (); if ($p ne '') { &connect_to_data_server (); print S 'n 1 ', $p; print S 'EOF'; $n = &get_matches (); $scoresort = 0; @matches = sort byname @matches; } print '
There are other search forms available.'; print 'For help using this form, please refer to the hints page.'; print '
Enter the exact name for which you are searching ->'; print ''; print '
You'; $pp = $p; if ($p =~ /["]/) { print $you, ' typed something in quotes.'; $pp =~ tr/"//d; $without = ' without the quotes'; $you = 'You also'; } if ($pp !~ /[A-Z]/) { print $you, ' typed the name entirely in lower case.'; $in = 'in'; $you = 'You also'; } elsif ($pp !~ /[a-z]/) { print $you, ' typed the name entirely in UPPER CASE.'; $in = 'in'; $you = 'You also'; } elsif ($pp =~ /^[a-z]/) { print $you, ' typed the name with a lower case initial.'; $in = 'in'; $you = 'You also'; } if ($pp =~ /[*?\\]/) { print $you, ' typed something that looked like a wildcard.'; print 'Perhaps you should try a'; print '', 'case-', $in, 'sensitive pattern search', $without, '.'; } elsif ($pp !~ /\s/) { print $you, ' typed only one word of the name.'; print 'Perhaps you would like to see'; print '', 'all names containing the word "', &escape($pp),'"'; print 'or'; print '', 'all names beginning with "', &escape($pp),'"'; } elsif ($in ne '') { print 'Perhaps you should try a'; print '', 'case-insensitive pattern search', $without, '.'; } elsif ($without ne '') { print 'Perhaps you should'; print '', 'try again', $without, '.'; } elsif (&permute($pp) ne $pp) { $pp = &permute($pp); print 'Perhaps you should try'; print '', &escape($pp), '.'; } elsif ($pp =~ /^([a-z][a-z]).* ([a-z])\S+$/i) { print 'Perhaps you should look at'; print '', 'names of the form "', $1, '... ', $2, '...".'; } } print '
', 'Convert to complex search.'; # print '
', # 'Request a correction of an item above.'; } &print_trailer (); # end of /web/herald/htdocs/heraldry/OandA/oanda_name.cgi