#!/usr/bin/perl # #Make sure that the above line is at the very first line, not #several lines down, and that it is completely flush with #the left margin, or your script will not work. #The first two characters of the first line of your script #should read #! and should be completely flush with the #left margin. If this is not the case, then it is likely that #your web browser tried to convert this text file to a web page #and reformatted this page, which will make it unusable, an #error common with MS Internet Explorer. Redownload this file #as a text file, not an HTML file. #(c)FLATTEXT Database Scripts 1997-2002 use CGI; $query = new CGI; #You need to modify this script at all parts of Step B #Depending on where Perl is on your server, the above location #may not be correct. To find where Perl is, telnet to your #server and at the prompt type: which perl This will tell you #the correct path to Perl on your server. Or, contact your #server administrator #Script Description #Unique script ID: e36b-dafe #Created on: 4/27/2004 #Last edited on: 6/8/2004 #Script class: B #You can edit this script on our server any time up to two years #after it was first created or last edited. The values that you used #to create this script will be loaded and you can change the #configurations as needed. Any edits you make to this script offline #should be marked with comments so that you can easily find them and #transfer them to any upgraded scripts you create #See http://flattext.com #STEP A================================ #SCRIPT USAGE #This is FLATTEXT 7.0, released March 1, 2002 #COPYRIGHT NOTICE #FLATTEXT License for Regular Scripts #All FLATTEXT scripts are copyright (c) FLATTEXT Database #Scripts, Inc. 1997-2002. Legally, you must retain the copyright #line inside the script. You are free to remove the printed #"Search results by FLATTEXT" text that appears inside Step #L of your script (see below), but under no circumstances #should the copyright assignment line (above) be removed. #Each script is licensed for use on a single computer or #server. Running multiple versions of the same script, or #continually editing the same script for different uses is #not permitted. Each implementation of the script requires #a new license (exceptions to this are those who have #purchased a Developer License, or those who have made #separate and written arrangements with us). All scripts #created by Developer License holders are automatically #licensed. #By using any of our scripts, you agree not to hold us #liable for any lost data, time, or any other costs #directly or indirectly associated with the use of our product. #Many of the common problems are addressed in the help #files at: #http://flattext.com/help/ #A1. The following lines get and process data passed #through the URL, do not modify $stringpassed=$ENV{'QUERY_STRING'}; #A2. Replace all plusses with spaces for data passed via URL $stringpassed=~s/\+/ /g; #STEP B================================ #You MUST modify each of the variables in this this section #B1. REQUIRED: The location of the data file on your server. This must #be the PATH to your data file, not the URL of your data file! There #is extensive treatment of this in the Help Pages, under Data File #Errors: http://flattext.com/help/ $data="../searches/show.txt"; #B2. REQUIRED: The URL of this script file in your cgi-bin directory. #You can provide the full URL, beginning with http:// (or, you can #simply use the filename, i.e. "database.cgi") $thisurl="show.cgi"; #B3. OPTIONAL: You can format the opening and closing HTML #of your results page in a separate file that can be written in #regular HTML and saved on your server. If your script can't #find this file and open it, the default result screen is displayed #instead. For ease of configuration, place it in the same directory #as your data file. Note: this file must have three plusses +++ #where you want your search results inserted. See help file #under Template Problems: http://flattext.com/help/ #Note, you are providing a full or relative server PATH here. A #URL will not work. $openinghtml="../results.htm"; #B4. REQUIRED TO ADD, DELETE, OR MODIFY. See #important information in the help files about adding additional #Security features to your script. #Change password to any combination of letters (A-Z, a-z) and #numbers 0-1. USE ONLY LETTERS AND NUMBERS $adminpassword="arbaexec1gcc"; #B5. URL to send users to after posting, editing, or getting errors. #This is usually the main page for this section of your site $forwardingURL="../searches/showadmin.htm"; #STEP C================================ #C1. Maximum number of matching records to display per page $maximumpage=25; #C2. Maximum total number of records to display per search, #for stylistic reasons, should be multiple of above number $maximum=250; #STEP D================================ #You should not need to modify this section at all #D1. Check to see if opening html file is on server if (-e "$openinghtml"){ #D2. If so, open it and write opening and closing text to different strings #to be used throughout the script $problem="Can't open template file. Make sure you are referencing the file and not just a directory."; open(OPENING, "$openinghtml") || &security; @wholefile=; close(OPENING); $fulltemplate=join("\n",@wholefile); ($templatestart,$templateend)=split(/\+\+\+/,$fulltemplate);} else{ #D3. If template file not found, use this for now $templatestart="$templatetitle"; $templateend="";} $delimiter="\t"; #D6. Get Password Entered by User $checkpassword=$query->param('checkpassword'); #D7. Figure out what action user wants to take. $actiontotake=$query->param('actiontotake'); $linenumberpass=$query->param('linenumberpass'); #D8. If user wants to delete record, and has already #verified password, then go to the makechange subroutine if ($actiontotake eq "Delete Record"){ $recordaction="Deleted"; &makechange; exit;} #D9. If user wants to edit record, and has already #verified password, then go to the makechange subroutine if ($actiontotake eq "Edit Record"){ $recordaction="Edited"; &makechange; exit;} #D10. If user wants to edit record, to go subroutine to verify if ($actiontotake eq "Edit"){ &edit; exit;} #D11. If user wants to delete record, to go subroutine to verify if ($actiontotake eq "Delete"){ &delete; exit;} #D12. If user wants to add record, go to add subroutine if ($actiontotake eq "Add"){ &addrecord; exit;} #STEP E================================ #E1. Get the data passed from user @Location_Statearray=$query->param('Location_State'); $searchelemcount=@Location_Statearray; if ($searchelemcount==1){ @Location_Statearray=split(/; /,$Location_Statearray[0]);} $Location_State=join("\; ",@Location_Statearray); $Location_State=~s/Select; //g; $Location_Statework=lc($Location_State); #E1b. The line below chops characters that cause problems in Perl word searches $Location_Statework=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd; if ($Location_Statework eq "select"){ $Location_Statework=""; $Location_State="";} $Location_Statepass="$Location_State"; #E1. Get the data passed from user @Start_Datearray=$query->param('Start_Date'); $searchelemcount=@Start_Datearray; if ($searchelemcount==1){ @Start_Datearray=split(/; /,$Start_Datearray[0]);} $Start_Date=join("\; ",@Start_Datearray); $Start_Date=~s/Select; //g; $Start_Datework=lc($Start_Date); #E1b. The line below chops characters that cause problems in Perl word searches $Start_Datework=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd; if ($Start_Datework eq "select"){ $Start_Datework=""; $Start_Date="";} $Start_Datepass="$Start_Date"; #E1. Get the data passed from user $Club=$query->param('Club'); $Clubwork=lc($Club); #E1b. The line below chops characters that cause problems in Perl word searches $Clubwork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd; if ($Clubwork eq "select"){ $Clubwork=""; $Club="";} $Clubpass="$Club"; #E1. Get the data passed from user $City_of_Show=$query->param('City_of_Show'); $City_of_Showwork=lc($City_of_Show); #E1b. The line below chops characters that cause problems in Perl word searches $City_of_Showwork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd; if ($City_of_Showwork eq "select"){ $City_of_Showwork=""; $City_of_Show="";} $City_of_Showpass="$City_of_Show"; #E1. Get the data passed from user @Openarray=$query->param('Open'); $searchelemcount=@Openarray; if ($searchelemcount==1){ @Openarray=split(/; /,$Openarray[0]);} $Open=join("\; ",@Openarray); $Open=~s/Select; //g; $Openwork=lc($Open); #E1b. The line below chops characters that cause problems in Perl word searches $Openwork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd; if ($Openwork eq "select"){ $Openwork=""; $Open="";} $Openpass="$Open"; #E1. Get the data passed from user @Youtharray=$query->param('Youth'); $searchelemcount=@Youtharray; if ($searchelemcount==1){ @Youtharray=split(/; /,$Youtharray[0]);} $Youth=join("\; ",@Youtharray); $Youth=~s/Select; //g; $Youthwork=lc($Youth); #E1b. The line below chops characters that cause problems in Perl word searches $Youthwork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd; if ($Youthwork eq "select"){ $Youthwork=""; $Youth="";} $Youthpass="$Youth"; #E1. Get the data passed from user @Breed_Showarray=$query->param('Breed_Show'); $searchelemcount=@Breed_Showarray; if ($searchelemcount==1){ @Breed_Showarray=split(/; /,$Breed_Showarray[0]);} $Breed_Show=join("\; ",@Breed_Showarray); $Breed_Show=~s/Select; //g; $Breed_Showwork=lc($Breed_Show); #E1b. The line below chops characters that cause problems in Perl word searches $Breed_Showwork=~tr/[a-zA-Z0-9 \.\,\?\@\-]/ /cd; if ($Breed_Showwork eq "select"){ $Breed_Showwork=""; $Breed_Show="";} $Breed_Showpass="$Breed_Show"; #E6. Get number of records already displayed $startitem=$query->param('startitem'); #E7. Figure the last record to display on this page $enditem=$startitem+$maximumpage; #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Location_Statework=~tr/[ÈÉÊËéêëè]/e/; #$Location_Statework=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/; #$Location_Statework=~tr/[çÇ]/c/; #$Location_Statework=~tr/[ìíîïÍÎÏÌ]/i/; #$Location_Statework=~tr/[ÒÓÔÕÖòóôõöô]/o/; #$Location_Statework=~tr/[ÙÚÛÜùúûü]/u/; ($Location_Stateone, $Location_Statetwo, $Location_Statethree, $Location_Statefour, $Location_Statefive, $Location_Statesix, $Location_Stateseven)=split(/ /, $Location_Statework); #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Start_Datework=~tr/[ÈÉÊËéêëè]/e/; #$Start_Datework=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/; #$Start_Datework=~tr/[çÇ]/c/; #$Start_Datework=~tr/[ìíîïÍÎÏÌ]/i/; #$Start_Datework=~tr/[ÒÓÔÕÖòóôõöô]/o/; #$Start_Datework=~tr/[ÙÚÛÜùúûü]/u/; ($Start_Dateone, $Start_Datetwo, $Start_Datethree, $Start_Datefour, $Start_Datefive, $Start_Datesix, $Start_Dateseven)=split(/ /, $Start_Datework); #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Clubwork=~tr/[ÈÉÊËéêëè]/e/; #$Clubwork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/; #$Clubwork=~tr/[çÇ]/c/; #$Clubwork=~tr/[ìíîïÍÎÏÌ]/i/; #$Clubwork=~tr/[ÒÓÔÕÖòóôõöô]/o/; #$Clubwork=~tr/[ÙÚÛÜùúûü]/u/; ($Clubone, $Clubtwo, $Clubthree, $Clubfour, $Clubfive, $Clubsix, $Clubseven)=split(/ /, $Clubwork); #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$City_of_Showwork=~tr/[ÈÉÊËéêëè]/e/; #$City_of_Showwork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/; #$City_of_Showwork=~tr/[çÇ]/c/; #$City_of_Showwork=~tr/[ìíîïÍÎÏÌ]/i/; #$City_of_Showwork=~tr/[ÒÓÔÕÖòóôõöô]/o/; #$City_of_Showwork=~tr/[ÙÚÛÜùúûü]/u/; ($City_of_Showone, $City_of_Showtwo, $City_of_Showthree, $City_of_Showfour, $City_of_Showfive, $City_of_Showsix, $City_of_Showseven)=split(/ /, $City_of_Showwork); #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Openwork=~tr/[ÈÉÊËéêëè]/e/; #$Openwork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/; #$Openwork=~tr/[çÇ]/c/; #$Openwork=~tr/[ìíîïÍÎÏÌ]/i/; #$Openwork=~tr/[ÒÓÔÕÖòóôõöô]/o/; #$Openwork=~tr/[ÙÚÛÜùúûü]/u/; ($Openone, $Opentwo, $Openthree, $Openfour, $Openfive, $Opensix, $Openseven)=split(/ /, $Openwork); #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Youthwork=~tr/[ÈÉÊËéêëè]/e/; #$Youthwork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/; #$Youthwork=~tr/[çÇ]/c/; #$Youthwork=~tr/[ìíîïÍÎÏÌ]/i/; #$Youthwork=~tr/[ÒÓÔÕÖòóôõöô]/o/; #$Youthwork=~tr/[ÙÚÛÜùúûü]/u/; ($Youthone, $Youthtwo, $Youththree, $Youthfour, $Youthfive, $Youthsix, $Youthseven)=split(/ /, $Youthwork); #F4a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$Breed_Showwork=~tr/[ÈÉÊËéêëè]/e/; #$Breed_Showwork=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/; #$Breed_Showwork=~tr/[çÇ]/c/; #$Breed_Showwork=~tr/[ìíîïÍÎÏÌ]/i/; #$Breed_Showwork=~tr/[ÒÓÔÕÖòóôõöô]/o/; #$Breed_Showwork=~tr/[ÙÚÛÜùúûü]/u/; ($Breed_Showone, $Breed_Showtwo, $Breed_Showthree, $Breed_Showfour, $Breed_Showfive, $Breed_Showsix, $Breed_Showseven)=split(/ /, $Breed_Showwork); #STEP G================================ #Do not modify this section #G1. Open datafile and write contents to an array, if can't open report the problem at the security subroutine $problem="You do not have a file to search on the server. Please ADD test records before trying to search your test data file."; open (FILE, "$data") || &security; @all=; close (FILE); #G2. The line below is required, do not modify print "Content-type: text/html\n\n"; #G3. Display HTML Header print "$templatestart\n"; #G5. Show words user searched for print "You Searched For:
    \n"; if ($Location_State){ print "
  • Location State\=$Location_State\n";} if ($Start_Date){ print "
  • Start Date\=$Start_Date\n";} if ($Club){ print "
  • Club\=$Club\n";} if ($City_of_Show){ print "
  • City of Show\=$City_of_Show\n";} if ($Open){ print "
  • Open\=$Open\n";} if ($Youth){ print "
  • Youth\=$Youth\n";} if ($Breed_Show){ print "
  • Breed Show\=$Breed_Show\n";} print "
\n"; #STEP H================================ #H1. Read each line of the data file, compare with search words foreach $line (@all){ $line=~s/\n//g; $loopsaround++; $checkleng=length($line); if ($checkleng<2){next}; $linetemp1=lc($line); #H1a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$linetemp1=~tr/[ÈÉÊËéêëè]/e/; #$linetemp1=~tr/[ÀÁÂÃÄÅÆàáâãäåæ]/a/; #$linetemp1=~tr/[çÇ]/c/; #$linetemp1=~tr/[ìíîïÍÎÏÌ]/i/; #$linetemp1=~tr/[ÒÓÔÕÖòóôõöô]/o/; #$linetemp1=~tr/[ÙÚÛÜùúûü]/u/; ($Location_State,$Start_Date,$End_Date,$Club,$City_of_Show,$Show_Secretary,$Address,$Address_2,$City,$State,$Zip,$Open,$Youth,$Breed_Show,$Contact_1,$Contact_2,$skipthisfield)=split (/$delimiter/,$linetemp1); #H9. This line specifies the fields to sort results by #See help databases for patches to allow various kinds of sorts $line="$Start_Date$Location_State$delimiter$loopsaround$delimiter$line"; #H9.5 This line removes stray leading spaces before sorting your results $line=~s/^ +//; $increcount=0; #H11. Look for any word entered in this field if (!$Location_Statework){ $increcount++; }else{ foreach $chunk (@Location_Statearray){ $chunk=~s/\(/\\\(/g; $chunk=~s/\)/\\\)/g; if ($Location_State=~/\b$chunk/i){ $increcount++; last;}}} #H11. Look for any word entered in this field if (!$Start_Datework){ $increcount++; }else{ foreach $chunk (@Start_Datearray){ $chunk=~s/\(/\\\(/g; $chunk=~s/\)/\\\)/g; if ($Start_Date=~/\b$chunk/i){ $increcount++; last;}}} #H12. Look for matches in field named Club if (($Club =~/\b$Clubone/ && $Club =~/\b$Clubtwo/ && $Club =~/\b$Clubthree/ && $Club =~/\b$Clubfour/ && $Club =~/\b$Clubfive/ && $Club=~/\b$Clubsix/ && $Club=~/\b$Clubseven/) || !$Clubwork) { $increcount++;} #H12. Look for matches in field named City_of_Show if (($City_of_Show =~/\b$City_of_Showone/ && $City_of_Show =~/\b$City_of_Showtwo/ && $City_of_Show =~/\b$City_of_Showthree/ && $City_of_Show =~/\b$City_of_Showfour/ && $City_of_Show =~/\b$City_of_Showfive/ && $City_of_Show=~/\b$City_of_Showsix/ && $City_of_Show=~/\b$City_of_Showseven/) || !$City_of_Showwork) { $increcount++;} #H11. Look for any word entered in this field if (!$Openwork){ $increcount++; }else{ $nomatch=0; foreach $chunk (@Openarray){ if ($Open!~/\b$chunk/i){ $nomatch=1;; }} if (!$nomatch){ $increcount++;} } #H11. Look for any word entered in this field if (!$Youthwork){ $increcount++; }else{ foreach $chunk (@Youtharray){ $chunk=~s/\(/\\\(/g; $chunk=~s/\)/\\\)/g; if ($Youth=~/\b$chunk/i){ $increcount++; last;}}} #H11. Look for any word entered in this field if (!$Breed_Showwork){ $increcount++; }else{ foreach $chunk (@Breed_Showarray){ $chunk=~s/\(/\\\(/g; $chunk=~s/\)/\\\)/g; if ($Breed_Show=~/\b$chunk/i){ $increcount++; last;}}} if ($increcount==7){ push (@keepers,$line);}} #STEP J================================ #J1. Sort matches stored in array. @keepers=sort(@keepers); #J2. Get and display number of matches found $length1=@keepers; #J3. If the number of matches is less than enditem, adjust if ($length1<$enditem){ $enditem=$length1; $displaystat="Y";} #J4. The first field about to display $disstart=$startitem+1; #J5. Show user total number of matches found if ($length1){ print "$length1 Matches Found (displaying $disstart to $enditem)

\n"; } else { print "Your search found zero records, please try again.

\n";} #STEP K================================ #K1. Do some HTML formatting before showing results print "\n"; #K4. Keep track of results processed on this page foreach $line (@keepers){ #K5. Delete stray hard returns $line=~s/\n//g; #K6. Keep track of records displayed $countline1++; #K7. Decide whether or not this record goes on this page if ($countline1>$startitem && $countline1<=$enditem){ #K8. Open each line of sorted array for displaying ($sortfield,$loopsaround,$Location_State,$Start_Date,$End_Date,$Club,$City_of_Show,$Show_Secretary,$Address,$Address_2,$City,$State,$Zip,$Open,$Youth,$Breed_Show,$Contact_1,$Contact_2,$skipthisfield)=split (/$delimiter/,$line); #K15. Formatting for field Location_State. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Location_State){ print "\n";} #K15. Formatting for field Start_Date. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Start_Date){ print "\n";} #K15. Formatting for field End_Date. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($End_Date){ print "\n";} #K15. Formatting for field Club. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Club){ print "\n";} #K15. Formatting for field City_of_Show. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($City_of_Show){ print "\n";} #K15. Formatting for field Show_Secretary. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Show_Secretary){ print "\n";} #K15. Formatting for field Address. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Address){ print "\n";} #K15. Formatting for field Address_2. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Address_2){ print "\n";} #K15. Formatting for field City. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($City){ print "\n";} #K15. Formatting for field Open. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements { print "\n";} #K15. Formatting for field Breed_Show. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Breed_Show){ print "\n";} #K15. Formatting for field Contact_1. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Contact_1){ print "\n";} #K15. Formatting for field Contact_2. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if ($Contact_2){ print "\n";} #K11. Check passwords before showing edit and delete buttons if ($adminpassword eq $checkpassword){ print "\n";} print "\n"; #STEP L================================ #L1. If total displayed equals maximum you set, then exit if ($countline1 == $maximum && $maximum){ $problem2="Your search was terminated at $maximum records, please be more specific in your search"; last;} #L2. If script just got to last match then exit program if ($length1 == $countline1){ last;} #L3. If script is at the end of a page then show NEXT button if ($countline1 == $enditem && $displaystat ne "Y" && $maximum>$countline1){ $stopit="Y"; last; } }} print "
Location State:$Location_State
Start Date:$Start_Date
End Date:$End_Date
Club:$Club
City of Show:$City_of_Show
Show Secretary:$Show_Secretary
$Address
$Address_2
$City, $State $Zip
Show Type:$Open $Youth
Breed Show:$Breed_Show
Contact:$Contact_1
$Contact_2
  
\n"; #L4. Display NEXT MATCHES button if ($stopit eq "Y"){ print "

\n"; #L5. Pass hidden variables so script will know how to display next page print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print "
\n"; } #L6. Show problems print "

$problem2\n"; #L8. If opening.htm was found, show its closing html codes print "$templateend\n"; exit; #STEP M================================ sub security{ #M1. This is the subroutine that reports all problems print "Content-type: text/html\n\n"; print "$templatestart\n"; print "

Data Error

\n"; print "Please correct the following error:

$problem
\n"; print "$templateend\n"; exit; } #STEP N================================ sub edit{ #N1. Open data file and read it $problem="Can't open data file to read from it at edit subroutine"; open (FILE,"$data") || &security; @all=; close (FILE); #N2. Read each line of the data file foreach $line (@all){ $line=~s/\n//g; ($copyLocation_State,$copyStart_Date,$copyEnd_Date,$copyClub,$copyCity_of_Show,$copyShow_Secretary,$copyAddress,$copyAddress_2,$copyCity,$copyState,$copyZip,$copyOpen,$copyYouth,$copyBreed_Show,$copyContact_1,$copyContact_2,$skipthisfield)=split (/$delimiter/,$line); $keepcount++; #N3. Find the line user wants to modify if ($keepcount==$linenumberpass){ $linetokeep=$line; $linetokeep=~s/markedtoedit//g; last; } } #N4. Check password sent via hidden field if ($adminpassword ne $checkpassword){ $problem="Your password does not match the master password and appears to have been changed since logging onto this record."; &security;} #N6. Split matching line into its respective variables ($Location_State,$Start_Date,$End_Date,$Club,$City_of_Show,$Show_Secretary,$Address,$Address_2,$City,$State,$Zip,$Open,$Youth,$Breed_Show,$Contact_1,$Contact_2,$skipthisfield)=split (/$delimiter/,$linetokeep); #Required Header, do not delete print "Content-type: text/html\n\n"; #N8. If can't find opening html, display default header print "$templatestart\n"; print "

Edit this Record

\n"; print "

\n"; print "\n"; @Start_Date=split(/\; /,$Start_Date); foreach $content (@Start_Date){ $content=~tr/[a-zA-Z0-9]//cd; $checkStart_Date{$content}="checked";} print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; @Open=split(/\; /,$Open); foreach $content (@Open){ $content=~tr/[a-zA-Z0-9]//cd; $checkOpen{$content}="checked";} print "\n"; @Youth=split(/\; /,$Youth); foreach $content (@Youth){ $content=~tr/[a-zA-Z0-9]//cd; $checkYouth{$content}="checked";} print "\n"; @Breed_Show=split(/\; /,$Breed_Show); foreach $content (@Breed_Show){ $content=~tr/[a-zA-Z0-9]//cd; $checkBreed_Show{$content}="selected";} print "\n"; print "\n"; print "\n"; #N10. Pass values to next screen print "
Location State:
Start Date:
End Date:
Club:
City of Show:
Show Secretary:
Address:
Address 2:
City:
State:
Zip:
Open:\n"; print " Open
\n"; print "
Youth:\n"; print " Youth
\n"; print "
Breed Show:
Contact 1:
Contact 2:
\n"; print "\n"; print "\n"; print "

\n"; print "$templateend\n"; exit; } #STEP O================================ sub delete{ #O1. Open data file and read it $problem="Can't open data file to read from it at delete subroutine"; open (FILE,"$data") || &security; @all=; close (FILE); #O2. Read each line of the file foreach $line (@all){ $line=~s/\n//g; ($copyLocation_State,$copyStart_Date,$copyEnd_Date,$copyClub,$copyCity_of_Show,$copyShow_Secretary,$copyAddress,$copyAddress_2,$copyCity,$copyState,$copyZip,$copyOpen,$copyYouth,$copyBreed_Show,$copyContact_1,$copyContact_2,$skipthisfield)=split (/$delimiter/,$line); $keepcount++; #O3. Find line to delete if ($keepcount==$linenumberpass){ $linetokeep=$line; $linetokeep=~s/markedtoedit//g; last; } } ($Location_State,$Start_Date,$End_Date,$Club,$City_of_Show,$Show_Secretary,$Address,$Address_2,$City,$State,$Zip,$Open,$Youth,$Breed_Show,$Contact_1,$Contact_2,$skipthisfield)=split (/$delimiter/,$linetokeep); #O4. Check password sent via hidden field if ($adminpassword ne $checkpassword){ $problem="Your password does not match the master password."; &security;} #O6. Requred Header, do not delete print "Content-type: text/html\n\n"; print "$templatestart\n"; print "

Delete this Record?

\n"; ($Location_State,$Start_Date,$End_Date,$Club,$City_of_Show,$Show_Secretary,$Address,$Address_2,$City,$State,$Zip,$Open,$Youth,$Breed_Show,$Contact_1,$Contact_2,$skipthisfield)=split (/$delimiter/,$linetokeep); #O7. Show validation HTML print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
Location_State: $Location_State
Start_Date: $Start_Date
End_Date: $End_Date
Club: $Club
City_of_Show: $City_of_Show
Show_Secretary: $Show_Secretary
Address: $Address
Address_2: $Address_2
City: $City
State: $State
Zip: $Zip
Open: $Open
Youth: $Youth
Breed_Show: $Breed_Show
Contact_1: $Contact_1
Contact_2: $Contact_2

\n"; print "\n"; print "\n"; print "

\n"; #If opening.htm was not found, show default closing html codes print "$templateend\n"; exit; } #STEP P================================ sub makechange{ #P1. For each variable, translate it, remove any delimiters that #user may have accidentally included, replace hard returns with #HTML line breaks, and delete all carriage returns #Go to get variable subroutine and make sure add preferences apply if ($recordaction eq "Edited"){ &getvariables;} #P2. This step either replaces or empties the existing line if ($recordaction eq "Deleted"){ $replacementline="";} else{ $replacementline="$Location_State$delimiter$Start_Date$delimiter$End_Date$delimiter$Club$delimiter$City_of_Show$delimiter$Show_Secretary$delimiter$Address$delimiter$Address_2$delimiter$City$delimiter$State$delimiter$Zip$delimiter$Open$delimiter$Youth$delimiter$Breed_Show$delimiter$Contact_1$delimiter$Contact_2";} $problem="Can't open data file to read from it"; open (FILE,"$data") || &security; @all=; close (FILE); $linenumberpass--; $all[$linenumberpass]=$replacementline; $problem="Can't open temporary file. You need to chmod 777 the directory your data file is in. See the help files under Permissions for Class B Scripts."; #P6. Write the entire changed file to a temporary file open (FILE2,">$data.tmp") || &security; foreach $line (@all){ $line=~s/\n//g; print FILE2 "$line\n";} close(FILE2); #P7. Rename the temp file to your master data file $problem="Can't rename file after making change"; rename("$data.tmp", "$data") || &security; print "Content-type: text/html\n\n"; #P8. If can't find opening html, display default header print "$templatestart\n"; print "Your record has been $recordaction. Please click here to continue.\n"; close (FILE); #If opening.htm was not found, show default closing html codes print "$templateend\n"; exit; } #STEP Q================================ #This subroutine adds records to your database sub addrecord{ #Q1. Check password if ($adminpassword ne $checkpassword && $adminpassword){ $problem="The password you entered does not match your administration password. Please press BACK on your browser to fix this problem."; &security;} &getvariables; $replacementline="$Location_State$delimiter$Start_Date$delimiter$End_Date$delimiter$Club$delimiter$City_of_Show$delimiter$Show_Secretary$delimiter$Address$delimiter$Address_2$delimiter$City$delimiter$State$delimiter$Zip$delimiter$Open$delimiter$Youth$delimiter$Breed_Show$delimiter$Contact_1$delimiter$Contact_2"; #Q3. Write the new record to the bottom of the data file $problem="Can't write to the data file. Please verify its location and change its permissions to 777."; open (FILE2,">>$data") || &security; print FILE2 "$replacementline\n"; close(FILE2); print "Content-type: text/html\n\n"; #Q4. If can't find opening html, display default header print "$templatestart\n"; print "Your record has been added. Please click here to continue.\n"; #If opening.htm was not found, show default closing html codes print "$templateend\n"; exit; } #STEP R================================ sub getvariables{ #R1. This step checks your variables before adding/editing them $Location_State=$query->param('Location_State'); @Start_Date=$query->param('Start_Date'); $Start_Date=join("\; ",@Start_Date); $Start_Date=~s/Select; //g; $End_Date=$query->param('End_Date'); $Club=$query->param('Club'); $City_of_Show=$query->param('City_of_Show'); $Show_Secretary=$query->param('Show_Secretary'); $Address=$query->param('Address'); $Address_2=$query->param('Address_2'); $City=$query->param('City'); $State=$query->param('State'); $Zip=$query->param('Zip'); @Open=$query->param('Open'); $Open=join("\; ",@Open); $Open=~s/Select; //g; @Youth=$query->param('Youth'); $Youth=join("\; ",@Youth); $Youth=~s/Select; //g; @Breed_Show=$query->param('Breed_Show'); $Breed_Show=join("\; ",@Breed_Show); $Breed_Show=~s/Select; //g; $Contact_1=$query->param('Contact_1'); $Contact_2=$query->param('Contact_2'); #R3. Replace hard returns with
, cut carriage returns $Location_State=~s/\n/
/g; $Location_State=~s/\r//g; if ($Location_State eq "Select"){ $Location_State="";} #R3. Replace hard returns with
, cut carriage returns $Start_Date=~s/\n/
/g; $Start_Date=~s/\r//g; if ($Start_Date eq "Select"){ $Start_Date="";} #R3. Replace hard returns with
, cut carriage returns $End_Date=~s/\n/
/g; $End_Date=~s/\r//g; if ($End_Date eq "Select"){ $End_Date="";} #R3. Replace hard returns with
, cut carriage returns $Club=~s/\n/
/g; $Club=~s/\r//g; if ($Club eq "Select"){ $Club="";} #R3. Replace hard returns with
, cut carriage returns $City_of_Show=~s/\n/
/g; $City_of_Show=~s/\r//g; if ($City_of_Show eq "Select"){ $City_of_Show="";} #R3. Replace hard returns with
, cut carriage returns $Show_Secretary=~s/\n/
/g; $Show_Secretary=~s/\r//g; if ($Show_Secretary eq "Select"){ $Show_Secretary="";} #R3. Replace hard returns with
, cut carriage returns $Address=~s/\n/
/g; $Address=~s/\r//g; if ($Address eq "Select"){ $Address="";} #R3. Replace hard returns with
, cut carriage returns $Address_2=~s/\n/
/g; $Address_2=~s/\r//g; if ($Address_2 eq "Select"){ $Address_2="";} #R3. Replace hard returns with
, cut carriage returns $City=~s/\n/
/g; $City=~s/\r//g; if ($City eq "Select"){ $City="";} #R3. Replace hard returns with
, cut carriage returns $State=~s/\n/
/g; $State=~s/\r//g; if ($State eq "Select"){ $State="";} #R3. Replace hard returns with
, cut carriage returns $Zip=~s/\n/
/g; $Zip=~s/\r//g; if ($Zip eq "Select"){ $Zip="";} #R3. Replace hard returns with
, cut carriage returns $Open=~s/\n/
/g; $Open=~s/\r//g; if ($Open eq "Select"){ $Open="";} #R3. Replace hard returns with
, cut carriage returns $Youth=~s/\n/
/g; $Youth=~s/\r//g; if ($Youth eq "Select"){ $Youth="";} #R3. Replace hard returns with
, cut carriage returns $Breed_Show=~s/\n/
/g; $Breed_Show=~s/\r//g; if ($Breed_Show eq "Select"){ $Breed_Show="";} #R3. Replace hard returns with
, cut carriage returns $Contact_1=~s/\n/
/g; $Contact_1=~s/\r//g; if ($Contact_1 eq "Select"){ $Contact_1="";} #R3. Replace hard returns with
, cut carriage returns $Contact_2=~s/\n/
/g; $Contact_2=~s/\r//g; if ($Contact_2 eq "Select"){ $Contact_2="";} } #This is the last line of the script