#! /usr/bin/perl # (c) 1999 the RAID GROUP / for the.raidgroup.net # golemite@pacbell.net # ---------------------------- define variables --------- # 1.71 updated for neils new search $version = "v1.71"; $n = 0; $note_limit = 45; $ENV{'QUERY_STRING'} =~ tr/+/ /; $ENV{'QUERY_STRING'} =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $ENV{'QUERY_STRING'} =~ s///g; if ($ENV{'QUERY_STRING'} eq 'search=') { &error; } ($string, $variable) = split(/=/, $ENV{'QUERY_STRING'}); @search_terms = split(/ /, $variable); print "Content-type: text/html\n\n"; print "\n\ns4biturbo.com: Audi S4 Owners' Resource: DTC (Check Engine Light) Search Engine"; open (FILE,"header_plain.inc"); @file = ; close FILE; print @file; open (FILE,"incl_ad1.inc"); @file = ; close FILE; print @file; print<<"EOF";

EOF if ($ENV{'QUERY_STRING'} eq '' || $ENV{'QUERY_STRING'} eq 'search=') { &start; } # ---------------------------- open file ---------------- open(DTC,"dtc.prn"); while($line = ) { chomp($line); $data[$n] = $line; $n++; } close(DTC); print "

DTC Search Results Found:

"; # ---------------------------- do real work ------------- $note = 0; # how many search terms found while($n != 0 && $note < $note_limit) { $matched = 0; $n--; $string = $data[$n]; ($dtc,$pcode,$description) = split(/;/,$string); $tmp_string = "$dtc $pcode $description"; # combines subject + content strings for ($x = 0; $x < @search_terms; $x++ ) { if( $tmp_string =~ /@search_terms[$x]/i ) # "eq" "ne" { $matched++; } } if ($matched eq @search_terms) { &print_dtc; $note++; } } if ( $note < 1 ) { print "\n\nsearch string \"@search_terms\" not found :(\n"; } else { if ( $note == $note_limit) { print "\n\nMore than $note matching items for \"@search_terms\" found in search, try narrowing your search..

\n"; } if ( $note == 1 ) { print "\n\n$note matching item for \"@search_terms\" found in search\n"; } else { print "\n\n$note matching items for \"@search_terms\" found in search\n"; } } &footer; exit; # ---------------------------- subroutines -------------- sub print_dtc { print "DTC: $dtc
\n"; print "P-Code: $pcode
\n"; print "Description: $description
\n"; print "Search Audiworld B5 S4 Discussions for this DTC: Go!

\n"; } sub error { print "No String Entered!\n"; &footer; exit; } sub start { print "

Enter a DTC number, P-Code, or Problem Keywords to search for:



\n"; print<<"EOF";

DTC Search can assist you in interpreting Diagnostic Codes "thrown" by your Audi ECU. These codes can be retreived via Ross-Tech's Vag-Com or other VW/Audi ODB tools (or from your local VW/Audi service shop).

Download Audi DTC listing in CSV format [ZIP]

EOF &footer; exit; } sub footer { print "
"; print "

raidgroup.net DTC Search $version (c)1999-2007
\n"; open (FILE,"footer_plain.inc"); @file = ; close FILE; print @file; }