#!/usr/bin/perl #Start the modules use strict; use CGI; #Create a new CGI object my $Page = new CGI; #The secret ingredient! use lib "../lib"; use HTML::Template; #Save that shit my $Shit = $Page->param('Info'); my $Le_File = $Page->param('file'); #If they used more than one word my $Wrong_Text = <<'TEXT'; You used a space in your query, which you should have not done. Instead, just use only one word. Please try your query again. TEXT #If they typed a symbol at the front of the word my $Wrong_Symbol = <<'WRONG'; Don\t type a symbol at the front of the word. Instead, just type the word in and hope for the best. Or, use the symbol \^ at the start of the word for matching names beginning with that word. Conversely, use \$ at the end of the word to get names ending in that word. Plus, this stuff is case sensitive. WRONG #If there is no file unless(open 'FILE', "../$Le_File") { print $Page->header(); print < No file

Make sure the file $Le_File is there

Now exiting program

HTMLSTUFF exit; } #Start a new template my $Template = HTML::Template -> new(filename => '../Template/Search_Engine.tmpl'); #Check the variable to see if it has spaces in it if ($Shit =~ m/ /g) { $Template->param(Bad_Stuff => "$Wrong_Text", option => 'value'); print $Template->output(); exit; } #Weed out other shit elsif ($Shit =~ m/^(\+|\-|\!|\#|\\)/g) { $Template->param(Bad_Stuff => "$Wrong_Symbol", option => 'value'); print $Template->output(); exit; } #Read the whole thing into an array my @Lines = ; close(FILE); #Use grep to find the goods my @Names = grep(m/$Shit/, @Lines); ############The whole thing #Print out the word Results $Template->param(Results => "

Here\'s the results for $Shit<\/p>"); #Use the looping schtick in HTML::Template to print out of the information in the array $Template->param(LE_LOOPY => [Le_Names => "@Names"]); ##########End it all #And finally print $Template->output();