Thank you for your responses, but I just can not get it to work, it has to post the results to a duplicate copy of the script, located in another directory..
This is the script I think it need to be posted into, as this is the xxxx.cgi, that is mentioned above...
#!/usr/bin/perl
if ($ENV{'SERVER_SOFTWARE'} =~ /microsoft/i)
{
$path = $ENV{'PATH_TRANSLATED'};
$path =~ /^(.*)\\[^\\]*$/;
$path = $1;
chdir $path;
}
require 'include/functions.cgi';
require 'include/search.cgi';
&loadsettings;
undef @cookies;
if ($settings{'debug'}) { open(DEBUG, ">$data_dir/debug.dat") }
use CGI;
use CGI::Carp qw/fatalsToBrowser/;
$smartsearch = 1;
$cgi = new CGI;
$keywords = $cgi->param('keywords');
$start = ($cgi->param('s') ne '') ? $cgi->param('s') : 0;
$username = $cgi->param('username');
$crawlsite = $cgi->param('crawlsite');
if ($crawlsite) { $settings{'crawl'} = $crawlsite }
$biddedtotal = $cgi->param('bt');
$freetotal = $cgi->param('f');
$catchall = $cgi->param('c');
$dbtotal = $cgi->param('db');
$external = $cgi->param('e');
$keywords =~ s/\///g;
$keywords =~ tr/A-Z/a-z/;
$keywords =~ s/\"//g;
$temp = '';
# Only one space between keywords
foreach ( split(/\s/, $keywords) )
{
if ( $_ ne '' )
{
if ($temp ne '') { $temp .= ' ' }
$temp .= $_;
}
}
$keywords = $temp;
if ($keywords eq '')
{
$info{'HIDDENFORM'} = '<input type="hidden" name="username" value="'.$username.'">';
&dotemplate('search_index.tpl');
exit;
}
$info{'KEYWORDS'} = $keywords;
if ($settings{'filter'})
{
if ( &dofilter($keywords) )
{
$info{'AFFILIATE'} = $username;
&dotemplate('search_filter.tpl');
exit;
}
}
if ($settings{'affiliate'} && $username ne '' && $start == 0 && $settings{'affiliate_per_search'} > 0) { require 'include/affiliate.cgi'; &afflog($username, 1, $settings{'affiliate_per_search'}) }
$klink = $keywords;
$klink =~ tr/ /+/;
$klinkgo = &Encrypt($keywords,$encryptkey,'dffkjhhrwhrh');
$klinkgo =~ s/ /+/g;
if ($settings{'dirs'}) { &dirs }
if ($start == 0 && $biddedtotal == 0)
{
$biddedtotal = -1;
$dbtotal = -1 if ($settings{'db_file'} ne '');
$freetotal = -1 if ($settings{'free_listings'});
$external = -2 if ($settings{'crawl'} ne '' || $settings{'outside_urls'} ne '');
}
$linecount = &dosearch($start, $settings{'display_max'}, 0, 'search_results_paid.tpl', 'search_results_free.tpl');
if ($linecount == 0)
{
$info{'AFFILIATE'} = $username;
&dotemplate('search_nomatch.tpl');
exit;
}
if ($dbtotal == -1) { &getdb(100000, 0, $settings{'db_file'}, $settings{'db_delimiter'}, $settings{'db_title'}-1, $settings{'db_desc'}-1, $settings{'db_url'}-1) }
if ($freetotal == -1) { &getfree(100000, 0) }
if ($external == -2)
{
require 'include/crawl.cgi';
&crawl(0, $linecount+1);
}
if ($external == -1)
{
$info{'ATLEAST'} = $settings{'search_at_least'};
$total = $biddedtotal + $dbtotal + $freetotal;
}
else { $total = $biddedtotal + $dbtotal + $freetotal + $external }
if ($linecount < $settings{'display_max'}) { $total = $start+$linecount }
if ($settings{'debug'})
{
print DEBUG "biddedtotal - $biddedtotal\n";
print DEBUG "dbtotal - $dbtotal\n";
print DEBUG "freetotal - $freetotal\n";
print DEBUG "external - $external\n";
}
$info{'TOTAL'} = $total;
if($start > 0)
{
$s = $start - $settings{'display_max'};
if ($catchall > 0) { $c = $s }
$info{'LINKPREV'} = "<a href=\"voobie.cgi?keywords=$klink&s=$s&bt=$biddedtotal&crawlsite=$crawlsite&c=$c&db=$dbtotal&e=$external&f=$freetotal&username=$username$crawlline\">$settings{display_last}</a>";
}
elsif ($settings{'logkeys'}) { &logkey }
if ($start+$linecount < $total)
{
$s = $start + $settings{'display_max'};
$info{'LINKNEXT'} = "<a href=\"voobie.cgi?keywords=$klink&s=$s&bt=$biddedtotal&crawlsite=$crawlsite&c=$catchall&db=$dbtotal&e=$external&f=$freetotal&username=$username$crawlline\">$settings{display_next}</a>";
}
$info{'START'} = $start+1;
$info{'END'} = $start+$linecount;
$info{'RESULTS'} = $results;
$info{'AFFILIATE'} = $username;
&dotemplate('search_main.tpl');
exit;
sub dotemplate
{
my ($temp) = @_;
&readtemplate('search_header.tpl');
$info{'HEADER'} = $tpl;
&readtemplate('search_footer.tpl');
$info{'FOOTER'} = $tpl;
&readtemplate($temp);
$info{'SITETITLE'} = $settings{'sitetitle'};;
$tpl =~ s/<<([^>]+)>>/$info{$1}/g;
if ($username ne '')
{
push @cookies, $cgi->cookie( -name => 'referrer', -value => $username, -expires => '+1y' );
}
print $cgi->header(-cookie=>[@cookies]);
print $tpl;
}
sub dirs
{
open(DATA, "$data_dir/directories.txt");
flock(DATA, $LOCK_SH);
$foundd = 0;
$count = 0;
my (@subcats, $subcat);
my($mycat) = '';
while ( $line = <DATA> )
{
my ($precat) = '';
$rkeywords = ®escape($keywords);
if ($line =~ /$rkeywords/i )
{
my($addto) = 1;
foreach $link ( split('/', $line) )
{
if ($link =~ /^($rkeywords)$/i)
{
$foundd = 1;
$mycat = $precat . "<b>$1</b>";
$addto = 2;
}
elsif ($addto == 1)
{
if ($link ne '')
{
$link2 = $link;
$link2 =~ tr/ /+/;
$precat .= "<a href=\"$settings{cgi_url}/voobie.cgi?keywords=$link2\">$link</a> > ";
}
}
elsif ($addto == 2)
{
$subcats{$link} = $count++;
$addto = 0;
}
}
}
}
flock(DATA, $LOCK_UN);
close(DATA);
if ($foundd)
{
foreach $link ( sort { $subcats{$a} <=> $subcats{$b} } keys %subcats )
{
$link2 = $link;
$link2 =~ tr/ /+/;
$mysubcat .= "<a href=\"$settings{cgi_url}/voobie.cgi?keywords=$link2\">$link</a><br>\n";
}
$info{'CATEGORIES'} = $mycat;
$info{'SUBCATEGORIES'} = $mysubcat;
}
}
sub direct_hit
{
if ($crawlsite == 3 || $crawlsite == 5) {return;}
@kdata = split(/&&/, $keydata[0]);
if ($settings{'debug'})
{
print DEBUG "In direct_hit\n";
for $i (0..$#kdata) { print DEBUG "$i - $kdata[$i]\n" }
}
if ($kdata[0] > 0 && $kdata[5] eq '')
{
$time = &Encrypt(time(),$encryptkey,'dffkjhhrwhrh');
$user = &Encrypt($kdata[1],$encryptkey,'dffkjhhrwhrh');
$url = &Encrypt($kdata[3],$encryptkey,'dffkjhhrwhrh');
$bid = &Encrypt($kdata[0],$encryptkey,'dffkjhhrwhrh');
my $k = &Encrypt($keywords,$encryptkey,'dffkjhhrwhrh');
$direct_hit_url = "$settings{frame_url}$settings{cgi_url}/go.cgi?u=$user&url=$url&b=$bid&t=$time&k=$k";
}
elsif ($kdata[5] ne '') { $direct_hit_url = $kdata[5] }
else
{
$direct_hit_url = $kdata[3];
$direct_hit_url =~ s/\&/\&/g;
}
if ($settings{'logkeys'}) { &logkey }
print "Location: $direct_hit_url\n\n";
exit;
}
sub logkey
{
open(DATA,">> $data_dir/keywordlog_$months[$month]-$dayofmonth-$year.txt");
flock(DATA, $LOCK_EX);
print DATA "$keywords\n";
flock(DATA, $LOCK_UN);
close(DATA);
}