OVH Cloud OVH Cloud

erreur serveur cobalt - script perl ver 5.0

2 réponses
Avatar
tech-informatique
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";
}
}


}

2 réponses

Avatar
leconte.jerome1
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 !
'lut

Oui y a un bail ... c'etait du a des erreur dans mon script, aux
chemins, fichier inexistant ou au droits incorrects ...

Essaie de le lancer en ligne de commande avec perl -w 'nomduscript'
V+


#!/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";
}
}


}




Avatar
Maxime Wojtczak
Et surtout un petit

print "Content-type: text/htmlnn";

serait plus que de bon aloi...

Max



leconte.jerome1 wrote:

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 !


'lut
Oui y a un bail ... c'etait du a des erreur dans mon script, aux
chemins, fichier inexistant ou au droits incorrects ...

Essaie de le lancer en ligne de commande avec perl -w 'nomduscript'
V+


#!/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";
}
}


}