#!/usr/bin/perl
###### /usr/local/bin/perl5 is an unusal name for the perl interpreter.
###### on many systems, perl is located in /usr/bin/perl, and rarely
###### carries a numeric suffix.
######
###### You can try executing "which perl" or "locate /perl"
###### to try and locate perl, if you don't know it's location
######
###### NT systems do not use this facility, but instead rely entirely
###### on the extension of the file (hence the need to name the file
###### with a .pl extension on most NT web servers)
############################################
# Library Search 1.1.0 release 1
#
# (c) copyright 1998-2000 NCP Technologies,
# At Connex Global Communication Systems Inc,
# Jaywil Software Dev. Inc. 1-800-815-8370
#
# Derived from Library Search 1.0.1 release 1, 7-Feb-2002
# by CCj/Clearline.
#
# Updates were many and various -- more complete
# abstraction of config variables, generalization of
# path handling, rewriting of date code to
# use internal time functions, removal of all
# file system operations during search, and
# and a compelete reimplementation of the search
# function (mostly to remove OS dependances,
# but also to fix a some minor searching bugs).
#
# The cprstrx function was removed.
# The CountEntries function was no longer
# used, and was removed.
#
# The number of code lines has been reduced in
# many places. All lines have been
# modified to conform to 80 column format.
#
# The level of generalization is now approximately
# suitable to allow for compilation of the code
# for platforms where perl interpreters are not
# available, should the need arise.
#
#
# This program is distributed WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.
#
#############################################################################
# Main Program Section
# *NOTE* no changes are required in this file whatsoever.. view lib.conf
#############################################################################
# Programming # Comments
#############################################################################
&GetQueryData; #
$loggedin = 0; # User Not Logged in initially.
$version = "1.1.0"; #
###### $virtual and $logoImage are used to describe web content on the forms
###### generated by this script. They may be overridden by the config
###### variables VIRTUAL and LOGO_IMAGE respectively. Note the trailing
###### slash for virtual.
$virtual = "http://www.google.com/search/";
$logoImage = "logo.gif";
###### These two variables are new -- NT requires that certain types of
###### executables have certain exteinsions, and it also requires
###### backslashes as directory separators. These variables here are the UNIX
###### defaults. The config file variables CGISCRIPT, and DIRSEP
###### will override these defaults on any platform, and must be defined on NT.
$script = "libsearch.cgi";
$dirsep = "/";
###### $countpath defines the path to your count directory. Reads value of
###### "x1" to assign the correct count -- each new library created will have
###### a unique value, and this script will automatically generate a count data
###### file if it doesn't exist. Define COUNTPATH in the config file to
###### override this default. Note that on UNIX this may be a relative
###### pathname. On NT it must be a fully qualified pathname.
$countpath = "tmp";
###### Similarly these are defaults for the mail program, the organisation
###### name, and a URL to associate with the organisation's name. They
###### may be overriden by the MAILPROG, ORG_NAME, and ORG_URL config
###### vars respectively.
$mailProg = "/usr/sbin/sendmail -t";
$orgName = "Our Favourite Org, Inc.";
$orgUrl = "http://www.google.com/";
#
# Set up name arrays for weekdays and month names.
#
@weekdays=( "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun");
@months=( "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
#
# Translate timezone-localised 'time' into a "struct tm" array.
#
($sec, $min, $hour, $mday, $month, $year, $wday, $yday, $ds) = localtime(time);
#
# Save the year for use in the copyright message.
#
$cpr_year=1900+$year;
#
# Generate a datestring for use when generating mail.
#
$mailheader_date="$weekdays[$wday], $mday $months[$month] $cpr_year " .
"$hour:$min:$sec";
#
# Find the configuration file. If we are on NT, then likely the current
# directory is *NOT* the script directory and the first test will fail.
#
$libConf = "lib.conf";
($libConf = $ENV{PATH_TRANSLATED}) =~ s/[^\\]*$/lib.conf/ unless ( -e $libConf);
&ReadConf; # Read the configuration file.
&PrintHeader; # Print The Header Information > WWW
#print ("
\$libConf: $libConf
");
#print ("
\$mailProg: $mailProg
");
#print ("
generated date: $mailheader_date
");
#print ("
done reading config
");
&PrintCommands; # Print The Commands > WWW
#print ("
done printcommands
");
#
&PreformAction; # Preform the specified action. or default.
#print ("
done preformaction
");
&PrintFooter; # Print The Footer Information > WWW
#print ("
done printfooter
");
exit;
#############################################################################
#############################################################################
# Sub Procedures ############################################################
#############################################################################
#This Software is (c) 1998-1999 NCP Technologies and At Connex Global Communication Systems Inc
#This Software is (c) 1998-1999 NCP Technologies and At Connex Global Communication Systems Inc
############################################
# PrintFooter
# Purpose: To Print The footer info to the
# WWW
############################################
sub PrintFooter {
print <
(c) copyright $cpr_year $orgName.