#!/usr/bin/perl $| = 1; $hitCount = 0; $database = "/u1/www/transportuniverse/db2/search_17.txt"; $logfile = "/u1/www/transportuniverse/db1/searchlog.dat"; @table_fields = ("PICTURE","REPORT","YEAR","MAKE","MODEL","MILEAGE","PRICE","CURRENCY","ZIP","COUNTRY","STATE","CITY","ITEM","DEALER","URL","TITLE"); ################################################################################################## print "Content-type: text/html\n\n"; print qq~ Universal Search: Your Total Transportation Index Transport Universe - Transportation Auction and Car Auctions
Search Transport Universe
Any Vehicle Ever Made Is
At Your Fingertips!
      

CLASSIFIEDS
Universal Search FREE AND EASY REGISTRATION
CLICK HERE!
AUCTIONS
DEALERS

WANTED
JOBS

B2B

Our Exclusive Condition Reports Show Every Detail!
SEE EXAMPLE


ADD REPORT TO YOUR ITEM




Millions of page views every month!


 Over 1800 Transportation Categories.


SEARCH RESULTS
~; print "
Start A New Search"; print "
\n"; print "\n"; print "\n"; print "

\n"; ############################################################## # Parse from the web form ############################################################## read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @cgiPairs = split(/&/,$buffer); foreach $cgiPair (@cgiPairs) { ($name,$value) = split(/=/,$cgiPair); $value =~ s/\+/ /g; $value =~ s/%(..)/pack("c",hex($1))/ge; $form{$name} .= "\0" if (defined($form{$name})); $form{$name} .= "$value"; } ################################################ # SORT THE DATABASE AND PUT RESULTS IN @database_rows ################################################ #$sortit = $form{'sortby'}; if ($form{'sortit'} eq "") { $sortit = 2; } else { $sortit = $form{'sortit'}; } $start_display = $form{'startdisplay'}; $display_end = $form{'displayend'}; # First pick out the field, and move it to the beginning of the line open(FILE, "$database"); flock(FILE, $LOCK_EX); $count=0; @row1 =; close (FILE); while (@row1[$count] ne "") { $row = @row1[$count]; @row = split (/\|/, $row); $sortable_field = $row[$sortit]; unshift (@row, $sortable_field); $new_row = join ("\|", @row); push (@new_rows, $new_row); $count++ } # Next, sort the lines of the database if ($form{'order'} eq "alpha") { @sorted_rows = sort (@new_rows); } else { @sorted_rows = reverse sort (@new_rows); } #now put the field back where it belongs @database_rows = (); foreach $sorted_row (@sorted_rows) { @row = split (/\|/, $sorted_row); $sorted_field = shift (@row); $old_but_sorted_row = join ("\|", @row); push (@database_rows, $old_but_sorted_row); } #######Used to check the sorting # open FILE, ">/u1/www/transportuniverse/db2/sorted.txt"; # print FILE (@database_rows); # close FILE; ################################# # END OF SORT DATABASE ################################# $form{'searchtype'} = "all"; if ($form{'searchtext'} eq "") { $form{'searchtext'} = $searchtext; } @searchText = split(/\x20/,$form{'searchtext'}); foreach $test (@searchText) { if ($test =~ /\S{2,}/) {push (@searchKey, $test);} } if (! @searchKey) {print " Please Enter One Or More Keywords.
\n";} else { print"\n"; print ""; print "\n"; print "\n"; print "\n"; print"\n"; $count=1; foreach $inLine (@database_rows) { $line=$inLine; if ( $form{'field'} ne "") { @fields = split (/\|/, $inLine); $inLine=$fields[$form{'field'}]; } if ($form{'searchtype'} eq "any") {$foundFlag = "N";} else {$foundFlag = "Y";} foreach $test (@searchKey) { if ($inLine =~ /$test/i) { if ($form{'searchtype'} eq "any") { $foundFlag = "Y"; last; } } else { if ($form{'searchtype'} eq "all") { $foundFlag = "N"; last; } } #end of foreach inLine of @database_rows } # end ForEach Test ########################### ########################### # # normally the script this links to is $fields[10] # and for april.dat, $fields[10] is set for super # the chunk below points to nusuper, overriding the stored variable # ########################### ########################### if ($foundFlag eq "Y") { @fields = split(/\|/,$line); $hitCount++; $odd_row_color = '#DFDFDF'; if ($i % 2 == 1) { $bg = $odd_row_color; } else { $bg = '#ffffff'; } $i++; $ii++; $piciconpath = ""; $reporticonpath = ""; $camera=""; $camera =$piciconpath if ($fields[0] eq "Y"); $report = $fields[1]; $report =$reporticonpath if ($report eq "Y"); $link = "$fields[3] $fields[4]"; print"\n"; print"\n"; } $count++; } # end While InLine close(LINK); print "
Select a colum to sort these results in alpha-numeric order.
Uncheck the sort box to sort the results in reverse order


VEHICLEYEARMILEAGEPRICE
$camera $report$link
$fields[15]
$fields[2]$fields[5]\$$fields[6]
\n"; print "

Your search returned $hitCount entries.

\n"; } # } # else # end Else StartSearch # {print " Please Enter One Or More Keywords.

\n";} print qq~

~; $nowtime = localtime(time); open THEFILE, ">>$logfile"; print THEFILE "$form{'searchtext'}\|$hitCount\|$nowtime\n"; close THEFILE; #} ############################################################## # Display the footer ############################################################## ############################################## # Print The Page Footer # print <<"EOF";




Copyright © 1999/2000 Transport Universe Inc. All Rights Reserved.
 Use of this Web site constitutes acceptance of the TRANSPORT UNIVERSE User Agreement

EOF ;