#!/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: 757f-34cx #Created on: 5/9/2001 #Last edited on: 5/6/2002 #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="/home/serve/Sallee-Chevrolet/Adata/pricesdata3.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="http://www.sallee-chevrolet.com/Ascripts/pricesdata.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="/home/serve/Sallee-Chevrolet/Atemplate/prices.html"; #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="bowtie"; #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="http://www.sallee-chevrolet.com/Amanage/prices.html"; #STEP C================================ #C1. Maximum number of matching records to display per page $maximumpage=100; #C2. Maximum total number of records to display per search, #for stylistic reasons, should be multiple of above number $maximum=1000; #C3. Minimum number of characters user must search for $minimumcharacters=2; #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"; #D4. Get words entered by user $words=$query->param('words'); #D5. Checks to see if anything attached to URL if (length($stringpassed)>1){ ($words,$sf1)=split(/&&/,$stringpassed);} #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================================ #E2. Remove quotation marks from words entered by user $words=~s/\"//g; #E3. Remove word AND from search words since all #searches are and searches $words=~s/ and / /g; $words=~s/ AND / /g; #E4 Check to make sure that user has searched for the number of characters #you specified at C3. if (length($words)<$minimumcharacters && !$actiontotake){ $problem="Unable to execute your search. You need to search for at least 2 characters. Please press back on your browser to continue."; &security;} #E5. Get field user wants to search if (!$sf1){ $sf1=$query->param('sf1');} #E6. Get number of records already displayed $startitem=$query->param('startitem'); #E7. Figure the last record to display on this page $enditem=$startitem+$maximumpage; #STEP F================================ #Do not modify this section #F3. Lowercase search words to make matches easier $words2=$words; #F3a. Support for European characters. Uncomment and replace with your #character set in brackets for all non-English Characters. See help files. #$words=~tr/[��������]/e/; #$words=~tr/[��������������]/a/; #$words=~tr/[��]/c/; #$words=~tr/[��������]/i/; #$words=~tr/[�����������]/o/; #$words=~tr/[��������]/u/; $words=lc($words); #F4. Split words entered by user into seven variables ($one1, $two2, $three3, $four4, $five5, $six6, $seven7)=split(/ /, $words); #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"; #G4. Show words user searched for print "You Searched For: $words2
\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/; ($N_R,$Company,$PN,$Part,$Description,$Link,$Price,$CC,$Key,$Cost,$skipthisfield)=split (/$delimiter/,$linetemp1); #H2. This section specifies the fields to sort results by #See help databases for patches to allow various kinds of sorts $line="$Company$PN$Part$delimiter$loopsaround$delimiter$line"; #H3. This line removes stray leading spaces before sorting your results $line=~s/^ +//; #H4. If the variable sf1 is deleted from search page, then #search all of the fields in the database if ($sf1 eq ""){ $wholestring=" $Company $PN $Part $Description $Key"; if ($wholestring =~/\b$one1/ && $wholestring =~/\b$two2/ && $wholestring =~/\b$three3/ && $wholestring =~/\b$four4/ && $wholestring =~/\b$five5/ && $wholestring=~/\b$six6/ && $wholestring =~/\b$seven7/){ push (@keepers,$line);}} #H7. If the variable sf1 is named Company, then do this search if ($sf1 eq "Company" && $Company =~/\b$one1/ && $Company =~/\b$two2/ && $Company =~/\b$three3/ && $Company =~/\b$four4/ && $Company =~/\b$five5/ && $Company =~/\b$six6/ && $Company =~/\b$seven7/){ push (@keepers,$line);} #H7. If the variable sf1 is named PN, then do this search if ($sf1 eq "PN" && $PN =~/\b$one1/ && $PN =~/\b$two2/ && $PN =~/\b$three3/ && $PN =~/\b$four4/ && $PN =~/\b$five5/ && $PN =~/\b$six6/ && $PN =~/\b$seven7/){ push (@keepers,$line);} #H7. If the variable sf1 is named Part, then do this search if ($sf1 eq "Part" && $Part =~/\b$one1/ && $Part =~/\b$two2/ && $Part =~/\b$three3/ && $Part =~/\b$four4/ && $Part =~/\b$five5/ && $Part =~/\b$six6/ && $Part =~/\b$seven7/){ push (@keepers,$line);} #H7. If the variable sf1 is named Description, then do this search if ($sf1 eq "Description" && $Description =~/\b$one1/ && $Description =~/\b$two2/ && $Description =~/\b$three3/ && $Description =~/\b$four4/ && $Description =~/\b$five5/ && $Description =~/\b$six6/ && $Description =~/\b$seven7/){ push (@keepers,$line);} #H7. If the variable sf1 is named Key, then do this search if ($sf1 eq "Key" && $Key =~/\b$one1/ && $Key =~/\b$two2/ && $Key =~/\b$three3/ && $Key =~/\b$four4/ && $Key =~/\b$five5/ && $Key =~/\b$six6/ && $Key =~/\b$seven7/){ push (@keepers,$line);} #H8. If the variable sf1 is named All Below, then do this if ($sf1 eq "All Fields"){ $wholestring= "$Key $Description $Part $PN $Company "; if ($wholestring =~/\b$one1/ && $wholestring =~/\b$two2/ && $wholestring =~/\b$three3/ && $wholestring =~/\b$four4/ && $wholestring =~/\b$five5/ && $wholestring=~/\b$six6/ && $wholestring =~/\b$seven7/){ 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 #K3 Open table for results $totalmatches=@keepers; if ($totalmatches>0){ print "\n"; #Display headers of table print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; 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,$N_R,$Company,$PN,$Part,$Description,$Link,$Price,$CC,$Key,$Cost,$skipthisfield)=split (/$delimiter/,$line); #K15. Assign Table Colors $darkcolor="#EEEEEE"; $lightcolor="#FFFFFF"; #K16. Check for alternate colors $test=$colorcount%2; if ($test==0){ $rowcolor=$darkcolor;} else{ $rowcolor=$lightcolor;} $colorcount++; print "\n"; #K15. Formatting for field N_R. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if (!$N_R){ $N_R=" "; print "\n";} else{ print "\n";} #K15. Formatting for field Company. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if (!$Company){ $Company=" "; print "\n";} else{ print "\n";} #K15. Formatting for field PN. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if (!$PN){ $PN=" "; print "\n";} else{ print "\n";} #K15. Formatting for field Part. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if (!$Part){ $Part=" "; print "\n";} else{ print "\n";} #K15. Formatting for field Description. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if (!$Description){ $Description=" "; print "\n";} else{ print "\n";} #K15. Formatting for field Link. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if (!$Link){ $Link=" "; print "\n";} else{ print "\n";} #K15. Formatting for field Price. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if (!$Price){ $Price=" "; print "\n";} else{ print "\n";} #K15. Formatting for field CC. If you add any HTML, make sure you #put a backslash in front of all quote marks inside print statements if (!$CC){ $CC=" "; print "\n";} else{ print "\n";} print "\n"; #K18. Check password before showing edit and delete snippets if ($adminpassword eq $checkpassword){ 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 "
N RCompanyPNPartDescriptionLinkPriceCC
$N_R$N_R$Company$Company$PN$PN$Part$Part$Description$Description$Link$Link$Price$Price$CC$CC
\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"; } #L6. Show problems print "

$problem2\n"; #L7. Show credits. If registered, you can delete entire Step L7 #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; ($copyN_R,$copyCompany,$copyPN,$copyPart,$copyDescription,$copyLink,$copyPrice,$copyCC,$copyKey,$copyCost,$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 ($N_R,$Company,$PN,$Part,$Description,$Link,$Price,$CC,$Key,$Cost,$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"; print "\n"; print "\n"; print "\n"; $Description=~s/
/\n/g; $Description=~s/
/\n/g; print "\n"; $Link=~s/
/\n/g; $Link=~s/
/\n/g; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; #N10. Pass values to next screen print "
N R:
Company:
PN:
Part:
Description:
Link:
Price:
CC:
Key:
Cost:
\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; ($copyN_R,$copyCompany,$copyPN,$copyPart,$copyDescription,$copyLink,$copyPrice,$copyCC,$copyKey,$copyCost,$skipthisfield)=split (/$delimiter/,$line); $keepcount++; #O3. Find line to delete if ($keepcount==$linenumberpass){ $linetokeep=$line; $linetokeep=~s/markedtoedit//g; last; } } ($N_R,$Company,$PN,$Part,$Description,$Link,$Price,$CC,$Key,$Cost,$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"; ($N_R,$Company,$PN,$Part,$Description,$Link,$Price,$CC,$Key,$Cost,$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_R: $N_R
Company: $Company
PN: $PN
Part: $Part
Description: $Description
Link: $Link
Price: $Price
CC: $CC
Key: $Key
Cost: $Cost

\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="$N_R$delimiter$Company$delimiter$PN$delimiter$Part$delimiter$Description$delimiter$Link$delimiter$Price$delimiter$CC$delimiter$Key$delimiter$Cost";} $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="$N_R$delimiter$Company$delimiter$PN$delimiter$Part$delimiter$Description$delimiter$Link$delimiter$Price$delimiter$CC$delimiter$Key$delimiter$Cost"; #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 $N_R=$query->param('N_R'); $Company=$query->param('Company'); $PN=$query->param('PN'); $Part=$query->param('Part'); $Description=$query->param('Description'); $Link=$query->param('Link'); $Price=$query->param('Price'); $CC=$query->param('CC'); $Key=$query->param('Key'); $Cost=$query->param('Cost'); #R3. Replace hard returns with
, cut carriage returns $N_R=~s/\n/
/g; $N_R=~s/\r//g; if ($N_R eq "Select"){ $N_R="";} #R3. Replace hard returns with
, cut carriage returns $Company=~s/\n/
/g; $Company=~s/\r//g; if ($Company eq "Select"){ $Company="";} #R3. Replace hard returns with
, cut carriage returns $PN=~s/\n/
/g; $PN=~s/\r//g; if ($PN eq "Select"){ $PN="";} #R3. Replace hard returns with
, cut carriage returns $Part=~s/\n/
/g; $Part=~s/\r//g; if ($Part eq "Select"){ $Part="";} #R3. Replace hard returns with
, cut carriage returns $Description=~s/\n/
/g; $Description=~s/\r//g; if ($Description eq "Select"){ $Description="";} #R3. Replace hard returns with
, cut carriage returns $Link=~s/\n/
/g; $Link=~s/\r//g; if ($Link eq "Select"){ $Link="";} #R3. Replace hard returns with
, cut carriage returns $Price=~s/\n/
/g; $Price=~s/\r//g; if ($Price eq "Select"){ $Price="";} #R3. Replace hard returns with
, cut carriage returns $CC=~s/\n/
/g; $CC=~s/\r//g; if ($CC eq "Select"){ $CC="";} #R3. Replace hard returns with
, cut carriage returns $Key=~s/\n/
/g; $Key=~s/\r//g; if ($Key eq "Select"){ $Key="";} #R3. Replace hard returns with
, cut carriage returns $Cost=~s/\n/
/g; $Cost=~s/\r//g; if ($Cost eq "Select"){ $Cost="";} #R4. You have marked N_R as a field that must contain at least 1 #non-blank characters before allowing the field to be added. You can change the #requirement below, or comment out all 6 lines below step to skip validation $N_Rcheck=$N_R; $N_Rcheck=~s/ +/ /g; $N_Rcheck=length($N_Rcheck); if ($N_Rcheck<1){ $problem="Please press back on your browser and provide more information for the N_R field."; &security;} #R4. You have marked Company as a field that must contain at least 2 #non-blank characters before allowing the field to be added. You can change the #requirement below, or comment out all 6 lines below step to skip validation $Companycheck=$Company; $Companycheck=~s/ +/ /g; $Companycheck=length($Companycheck); if ($Companycheck<2){ $problem="Please press back on your browser and provide more information for the Company field."; &security;} #R4. You have marked PN as a field that must contain at least 2 #non-blank characters before allowing the field to be added. You can change the #requirement below, or comment out all 6 lines below step to skip validation $PNcheck=$PN; $PNcheck=~s/ +/ /g; $PNcheck=length($PNcheck); if ($PNcheck<2){ $problem="Please press back on your browser and provide more information for the PN field."; &security;} #R5. You have marked Part as a field that must contain at least 1 #words before allowing the field to be added. You can change the #requirement below, or comment out all 7 lines below step to skip validation $Partcheck=$Part; $Partcheck=~s/ +/ /g; @Partcheck=split(/ /,$Partcheck); $Partcheck=@Partcheck; if ($Partcheck<1){ $problem="Please press back on your browser and provide more information for the Part field."; &security;} #R5. You have marked Description as a field that must contain at least 2 #words before allowing the field to be added. You can change the #requirement below, or comment out all 7 lines below step to skip validation $Descriptioncheck=$Description; $Descriptioncheck=~s/ +/ /g; @Descriptioncheck=split(/ /,$Descriptioncheck); $Descriptioncheck=@Descriptioncheck; if ($Descriptioncheck<2){ $problem="Please press back on your browser and provide more information for the Description field."; &security;} #R4. You have marked Link as a field that must contain at least 2 #non-blank characters before allowing the field to be added. You can change the #requirement below, or comment out all 6 lines below step to skip validation $Linkcheck=$Link; $Linkcheck=~s/ +/ /g; $Linkcheck=length($Linkcheck); if ($Linkcheck<2){ $problem="Please press back on your browser and provide more information for the Link field."; &security;} #R4. You have marked Price as a field that must contain at least 2 #non-blank characters before allowing the field to be added. You can change the #requirement below, or comment out all 6 lines below step to skip validation $Pricecheck=$Price; $Pricecheck=~s/ +/ /g; $Pricecheck=length($Pricecheck); if ($Pricecheck<2){ $problem="Please press back on your browser and provide more information for the Price field."; &security;} #R4. You have marked CC as a field that must contain at least 2 #non-blank characters before allowing the field to be added. You can change the #requirement below, or comment out all 6 lines below step to skip validation $CCcheck=$CC; $CCcheck=~s/ +/ /g; $CCcheck=length($CCcheck); if ($CCcheck<2){ $problem="Please press back on your browser and provide more information for the CC field."; &security;} #R5. You have marked Key as a field that must contain at least 1 #words before allowing the field to be added. You can change the #requirement below, or comment out all 7 lines below step to skip validation $Keycheck=$Key; $Keycheck=~s/ +/ /g; @Keycheck=split(/ /,$Keycheck); $Keycheck=@Keycheck; if ($Keycheck<1){ $problem="Please press back on your browser and provide more information for the Key field."; &security;} #R4. You have marked Cost as a field that must contain at least 2 #non-blank characters before allowing the field to be added. You can change the #requirement below, or comment out all 6 lines below step to skip validation $Costcheck=$Cost; $Costcheck=~s/ +/ /g; $Costcheck=length($Costcheck); if ($Costcheck<2){ $problem="Please press back on your browser and provide more information for the Cost field."; &security;} } #This is the last line of the script