digital-cipher
08-23-2004, 06:16 PM
Hi all
i am trying to use dswimboy's cgi script to search a virtual directory on my web server.
Problem is it will search using the server path (ie c:\search) but not a virtual path (www.myserver.com\search)
i want the script to search a virtual path then generate a hyperlink to that file.
!!Any Help Please !!! :confused:
The below script is what im using !!!
#!/usr/bin/perl
#Edit this first line to your perl intercepter
#If not this, try #!/usr/local/bin/perl
use File::Find;
use CGI;
$q = new CGI;
$query = $q->param("search");
##############EDITING BEGINS HERE############################
@DIRLIST = ( 'd:');
#Put the partial server path to your directory which keeps your files that you want to be searched. There can be sub-directories within the searched directory.
#Help: You have to get the full server path to the directory where you are keeping your files. It might be something like /usr/pub/www/search
#In this case the 'home' path is /usr/pub/www. You have to replace the home path to ' ../ '
#so the directory in this case would be '../search' NO TRAILING SLASH
print "Content-type: text/html\n\n";
sub search {
if ($_ =~ /$query/i) {
$results++;
$path = $File::Find::name;
print "<body>\n";
#Insert whatever HTML you wish between the above print" and \n";
#DO NOT USE ANY INVERTED COMMONS (') OR QUOTATION MARKS (")
print "<a href='$path' target=_blank>$_</a><br>\n";
}
}
find (\&search, @DIRLIST);
unless ($results) {
print "No Results found\n";
}
i am trying to use dswimboy's cgi script to search a virtual directory on my web server.
Problem is it will search using the server path (ie c:\search) but not a virtual path (www.myserver.com\search)
i want the script to search a virtual path then generate a hyperlink to that file.
!!Any Help Please !!! :confused:
The below script is what im using !!!
#!/usr/bin/perl
#Edit this first line to your perl intercepter
#If not this, try #!/usr/local/bin/perl
use File::Find;
use CGI;
$q = new CGI;
$query = $q->param("search");
##############EDITING BEGINS HERE############################
@DIRLIST = ( 'd:');
#Put the partial server path to your directory which keeps your files that you want to be searched. There can be sub-directories within the searched directory.
#Help: You have to get the full server path to the directory where you are keeping your files. It might be something like /usr/pub/www/search
#In this case the 'home' path is /usr/pub/www. You have to replace the home path to ' ../ '
#so the directory in this case would be '../search' NO TRAILING SLASH
print "Content-type: text/html\n\n";
sub search {
if ($_ =~ /$query/i) {
$results++;
$path = $File::Find::name;
print "<body>\n";
#Insert whatever HTML you wish between the above print" and \n";
#DO NOT USE ANY INVERTED COMMONS (') OR QUOTATION MARKS (")
print "<a href='$path' target=_blank>$_</a><br>\n";
}
}
find (\&search, @DIRLIST);
unless ($results) {
print "No Results found\n";
}