Bonjour,
J'ai rédigé un script en perl (moteur de rechercher) à l'aide de bout de
code sur internet, il est donc personnalisé pour la structure de notre site,
seulement à chaque fois que j'ai envoyé un script pl dans notre répertoire
cgi-bin fait un chmod 755 le tout en ASCII s'il vous plait j'ai un message
d'erreur (qu'il soit développé par moi ou récupérer sur un site) :
Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request.
quelqu'un a-t-il déjà rencontré ce problème ??? sinon voilà le source de mon
cgi sans les chemins, merci d'avance !
#!/usr/bin/perl
# Lire les parametres en entree
$tagnosearch = '<!--NOSEEK//-->';
$url = "rep de base";
read(STDIN, $cache, $ENV{'CONTENT_LENGTH'});
@tabrequetes = split(/&/,$cache);
foreach $tabrequete(@tabrequetes){
($mot, $valeur) = split(/=/,$tabrequete);
$valeur =~ s/\+/ /g;
$FORM{$mot}=$valeur;
}
$basepath = '/home/sites/xxx/web/rep1/rep2/rep3';
@path = ('ssrep1','ssrep2','ssrep3',
'ssrep4','ssrep5','ssrep6',
'ssrep7');
@tabfich = ('*.html','*.php','*.htm')
;
@motsrecherche = split(/\s+/,$FORM{'motsrecherche'});
foreach $path(@path){
$absolutepath='';
$absolutepath = $basepath+$path;
chdir($absolutepath);
foreach $tabfich(@tabfich){
$ls = `ls $tabfich`;
@TABPAGES = split(/\s+/,$ls);
foreach $TABPAGE(@TABPAGES){
open(TABPAGE,"$TABPAGE");
if (<TABPAGE> ne $tagnosearch){
@lignes = <TABPAGE>;
close(TABPAGE);
$chaine = join('.', @lignes);
$chaine =~ s/\n//g;
foreach $motrecherche (@motsrecherche) {
if ($chaine=~ /$motrecherche/i) {
$INCLURE{$TABPAGE}='oui';
}
else{
$INCLURE{$TABPAGE}='non';
}
if ($chaine=~ /<title>(.*)<\title>/i) {
$TITRE{$TABPAGE} = "$1";
}
else {
$TITRE{$TABPAGE} = "$TABPAGE";
}
}
}
else{
close(TABPAGE);
}
}
foreach $resultat (%INCLURE) {
if ($INCLURE{$resultat} eq 'oui') {
print "<a href=\"$url$resultat\">$TITRE{$resultat}</a>\n";
}
}
}