#!/usr/bin/perl my $path = "/home/partner/search/"; # With a slash at the end use lib "/home/partner/search"; #Without a foward slash at the end use CGI::Carp qw(fatalsToBrowser); eval ("use DBI"); if ($@) { die "The DBI module used for MySQL appears to not be installed"; } my $dbh; $dbh = DBI->connect("DBI:mysql:bidsearchengine:localhost", "search2", "AbcD1!"); die ("database connect failed on main function") unless $dbh; ############################################### # Variables for User local (%FORM, $inbuffer, $qsbuffer, $buffer, @pairs, $pair, $name, $value); read(STDIN, $inbuffer, $ENV{'CONTENT_LENGTH'}); $qsbuffer = $ENV{'QUERY_STRING'}; foreach $buffer ($inbuffer,$qsbuffer) { @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; $value =~ s/~!/ ~!/g; $value =~ s/<([^>]|\n)*>//g; if ($config{'data'} eq "mysql") { $value = &escape($value); } $FORM{$name} = $value; } } $url="http://search2.co.uk/search.php?q="; $url= $url . $FORM{keywords}; print "Location: $url\n\n";