Simple Text Search Results

#!/usr/local/bin/perl

@fields = (‘Contact’,’Email’,’Religious/Secular’,’Concern’,’Agency Name’,’Affiliated With’,’Last Verified’,
‘Primary Address’,’Address2′,’City’,’State’,’Zip’,’HOURS’,’Phone’,
‘800-Phone’,’Fax’,’2Address’,’2Address2′,’2City’,’2State’,’2Zip’,
‘Service Area’,’written info on request’,’counselling referrals’,
‘Crisis Intervention’,’Professional Group’,’Support Group’,’Newsletter Fqy’,
‘COMMENTS’);
$view_fields = “‘Contact’,’Email’,’Religious/Secular’,’Concern’,’Agency Name’,’Affiliated With’,
‘Primary Address’,’Address2′,’City’,’State’,’Zip’,’HOURS’,’Phone’,’800-Phone’,
‘Fax’,’Service Area’,’Written info on request’,’Counselling referrals’,
‘Crisis Intervention’,’Professional Group’,’Support Group’,’Newsletter Fqy’,’COMMENTS'”;

$data_file = ‘save5.txt’;

#============================
#
# BODY OF PROGRAM
#
#

&print_header;

&parse_form;

&read_file;

if (!(&return_results)) {
&print_sorry;
}

&print_footer;

1;

#=========================================================
#
# This is the HTML section at the top of the page
#
# Anything between the phrases ‘EOHEADER’ is editable.
#
#

sub print_header {

print “Content-type: text/htmlnn”;
print <<"EOHEADER";

SAVE Simple Text Search Results


[ SAVE Home Page ] [ Child Abuse Prevention
Network
]



The database connected to this search engine is
Copyright 1997 by
S.A.V.E. and the Child Abuse Prevention Network. All rights reserved.

EOHEADER
}

#=========================================================
#
# This is the HTML section at the BOTTOM of the page
#
# Anything between the phrases ‘FOOTEND’ is editable.
#
#

sub print_footer {

print <<"FOOTEND";

This material is protected by U.S. and other copyrights. This material
(including the search engine) may not be copied, reproduced, sold or
redistributed in any form without the express written permission of SAVE.

Use of this site is conditioned upon acceptance of the Terms and
Conditions of S.A.V.E and the Child Abuse Prevention Network. S.A.V.E.
and the Child Abuse Prevention Network disclaim any warranty or
liability relating to errors, omissions, accuracy or fitness for a
particular purpose. The information content is intended for the
personal use of victims and survivors, and those who help victims and
survivors. ANY OTHER USE is strictly prohibited. It is a violation of
copyright to use this site as a source of information for the creation
of any document, electronic or otherwise, for publication or
distribution in any form. [email protected]

–>


[ SAVE Home Page ] [ Child Abuse Prevention
Network
]


FOOTEND

}

sub print_sorry {

print “

Sorry, there were no matches to your search.

n”;
print “Please try again.
n”;
print “

n”;
print “Search Textn”;
print “

n”;

}

sub read_file {

open (IN, “<$data_file"); @lines = ;
close (IN);

}

sub return_results {

local(@include);
local(@data);
local($line) = ”;
local($include) = ”;
if ($FORM{‘refine’}) {
$FORM{‘search’} .= ” $FORM{‘refine’}”;
}
local(@search_terms) = split (/s/,$FORM{‘search’});
print “Search Terms:

";
      foreach $s (@search_terms) {
        print "t$s";
      }
      print "

n”;
foreach $line (@lines) {
$include = ‘yes’;
foreach $s (@search_terms) {
if ($line !~ /$s/i) { $include = ‘no’; }
}
if ($include eq ‘yes’) {
unshift (@include, $line);
}
}
if (@include) {
print “

n”;
print “Refine your Searchn”;
print “n””;