#!/usr/bin/perl # Copy Right Charles Verge http://www.theverge.com/scripts/ # to install, # change $htmldir path to where you want to search. # upload to your cgi-bin directory and chmod 755 search.cgi # if you don't know where your html files are on the server # email your isp. # this script is only for small amounts of html files. use strict; use CGI qw(:standard); my $htmldir = "/path/to/your/homedir/"; my (@files , $found , $line , $i); my $string = param ("query"); sub search { my $dir = $_[0]; opendir INDIR , $dir; my @list = readdir INDIR; closedir INDIR; foreach $i (@list) { if (!($i =~ /^\./)) { if (! -d "$dir/$i") { if ($i =~ /\.htm/i) { #$found = 0; $! = 0; open IN , "$dir/$i"; #print "error $!\n"; while ($line = ) { #print $line; if ($line =~ /$string/i) { #print "$dir/$i\n"; #push (@files , "$dir/$i"); $found = "$dir/$i"; $found =~ s/$htmldir//g; print "$found\n"; last; } } close IN; } } else { search ("$dir/$i"); } } } } if ($string) { search ($htmldir); } print "
Search:
TheVerge Search";