Does no-one know? Hi. I am making a perl site search on my website and have this code
#!perl -w
use strict;
use File::Find;
use CGI qw
standard);
my $query = param("query");
print header();
print start_html();
print "\n<p>For the query $query, these results were found:</p>\n<ol>\n";
undef $/;
find( sub
{
return if($_ =~ /^\./);
return unless($_ =~ /\.html/i);
stat $File::Find::name;
return if -d;
return unless -r;
open(FILE, "< $File::Find::name") or return;
my $string = <FILE>;
close (FILE);
return unless ($string =~ /\Q$query\E/i);
my $page_title = $_;
if ($string =~ /<title>(.*?)<\/title>/is)
{
$page_title = $1;
}
print "<li><a href=\"$File::Find::name\">$page_title</a></li>\n";
},
'/home/username/public_html');
print "</ol>\n";
print end_html();
End
and this for the search box
<form action="/cgi-bin/search.pl" method="post">
<input name="query" type="text" size="20" maxlength="255" />
<input name="Search" type="submit" id="Search" value="Search" />
</form>
Where do I Put the code in my website so that the script will run?
I have perl, php, mysql apache whatever all enabled
Does anyone know?
#!perl -w
use strict;
use File::Find;
use CGI qw

my $query = param("query");
print header();
print start_html();
print "\n<p>For the query $query, these results were found:</p>\n<ol>\n";
undef $/;
find( sub
{
return if($_ =~ /^\./);
return unless($_ =~ /\.html/i);
stat $File::Find::name;
return if -d;
return unless -r;
open(FILE, "< $File::Find::name") or return;
my $string = <FILE>;
close (FILE);
return unless ($string =~ /\Q$query\E/i);
my $page_title = $_;
if ($string =~ /<title>(.*?)<\/title>/is)
{
$page_title = $1;
}
print "<li><a href=\"$File::Find::name\">$page_title</a></li>\n";
},
'/home/username/public_html');
print "</ol>\n";
print end_html();
End
and this for the search box
<form action="/cgi-bin/search.pl" method="post">
<input name="query" type="text" size="20" maxlength="255" />
<input name="Search" type="submit" id="Search" value="Search" />
</form>
Where do I Put the code in my website so that the script will run?
I have perl, php, mysql apache whatever all enabled
Does anyone know?
Last edited: