@katalog = ("Hosen", "Pullover", "Bekleidung-Sonstiges", "Jacken", "Unterwäsche", "Schuhe", "Rucksack", "Schlafsack", "Zelte", "Klettern", "Hardware-Sonstiges", "Kocher"); sub search { # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; if ($allow_html != 1) { $value =~ s/<([^>]|\n)*>//g; } else { unless ($name eq 'body') { $value =~ s/<([^>]|\n)*>//g; } } $FORM{$name} = $value; } if ($FORM{'search_text'}) { $search_text = "$FORM{'search_text'}"; $search_text =~ s///g; $search_text =~ s/\&//g; $search_text =~ s/\*//g; } $search_kat = "$FORM{'search_kat'}"; foreach (@katalog) { $searchrowfile = $sbagrowfiles[$kat_nummer]; open (FILE, $searchrowfile) || &error_log ("Fehler beim Lesen der Datei $searchrowfile"); while () { $rowtpl .= $_; } close (FILE); $search_positiona = 1; $search_positionb = 2; $search_positionc = 3; $search_positiond = 5; $search_positione = 6; $akt_zeile = 0; $akt_kat = 0; $kat_name = $katalog[$kat_nummer]; open (FILE, $data[$kat_nummer]) || &error_log ("Fehler beim Lesen der Katalog-Datei $data[$kat_nummer]"); while () { if ($_ !~ /^[\-|+|\n]/) { $akt_zeile++; # Kommentare Plus und Leerzeilen raus @tempvalue=split(/;/, $_); @s_text=split(/ +/,$search_text); $words=@s_text.""; $break=1; $s=0; $found=0; while ($s < $words & $found < $break) { if ($tempvalue[$search_positiona] =~ /@s_text[$s]/i) { ++$found; } if ($tempvalue[$search_positionb] =~ /@s_text[$s]/i) { ++$found; } if ($tempvalue[$search_positionc] =~ /@s_text[$s]/i) { ++$found; } if ($tempvalue[$search_positiond] =~ /@s_text[$s]/i) { ++$found; } if ($tempvalue[$search_positione] =~ /@s_text[$s]/i) { ++$found; } ++$s; } if ($found >= $break) { $newrow = $rowtpl; $newrow =~ s/BESTELL_NR/$tempvalue[0]/g; $newrow =~ s//$tempvalue[1]/g; if (-e "../shop/data/$tempvalue[0].gif") { $temp = ""; $newrow =~ s//$temp/g; } if (-e "../shop/data/$tempvalue[0].jpg") { $temp = ""; $newrow =~ s//$temp/g; } else { $temp = "  "; $newrow =~ s//$temp/g; } $newrow =~ s//$tempvalue[2]/g; $newrow =~ s//$tempvalue[3]/g; $newrow =~ s//$tempvalue[4]/g; $newrow =~ s/PROD_VAL/$namarr[1]/g; &HiASCII2LoASCII($newrow); $insstr .= $newrow; ++$found_sum; } } elsif ($_ =~ /^\+/) { ++$akt_kat; $akt_zeile=0; } } $kat_nummer++; close (FILE); } } if ($found_sum == 0) { $insstr = "  

Es wurden keine Artikel gefunden!

 "; } open (FILE, $searchtplfile) || &error_log ("Fehler beim Lesen der Datei $searchtplfile"); while () { $tplstr .= $_; } close(FILE); $functions = ""; $tplstr =~ s//$insstr/; $tplstr =~ s//$functions/; $style = ""; $tplstr =~ s//$style/; $tplstr =~ s//$html_base_dir\/$back_pic/g; $tplstr =~ s//$html_base_dir\/$gfx_dir/g; $COS = "Onlineshop"; $tplstr =~ s//$COS/; # --- HTML-Seite anzeigen --- print "Content-type: text/html\n\n" . $tplstr;