Página 3 de 3 PrimeiroPrimeiro 123
+ Responder ao Tópico



  1. #11
    crazy4tech
    Olá 1c3_m4n,

    Mudei o diretório de scripts cgi, mas o erro continua....

    O erro foi esse: (agora com a "/" antes do var)

    No such file or directory: exec of '/var/www/cgi-bin/automail.pl' failed, referer: http://www.servidor.com.br/teste/

    outro erro:

    - Premature end of script headers: automail.pl, referer: http://www.servidor.com.br/teste/

    Se puder me ajudar ficarei muito agradecido..

    Falow!!!!

  2. #12
    crazy4tech
    Não pode ser algum error de permissão de acesso???

    Fiz um teste anteriormente e coloquei 666, deu erro de acesso negado...

    Os arquivos do diretório cgi estão com permissão 755


    Falow...



  3. altere no teu script ao inves de chamar /var/www/cgi-bin/automail.pl use somente /cgi-bin/automail.pl

  4. #14
    crazy4tech
    O conteúdo do arquivo index.html:

    <title> AUTOMAIL: ADMINISTATION PAGE </title>
    <body bgcolor=white>
    <CENTER>
    <table width=100% height=100%><td><CENTER>
    <table border=2 width=500><td bgcolor=#C3A369 colspan=2>
    <font color=white face=arial size=6>[i]AutoMail version 3.1</font><br></td>
    <tr><tr><td bgcolor=beige align=right><font face=arial size=-1>Modify a user's information in fields</td><td>
    <font face=arial size=-1><A HREF="/cgi-bin/automail.pl?edit"><CENTER>Edit info</A></td>
    <tr><tr><td bgcolor=beige align=right><font face=arial size=-1>Compose a new personalized message</td><td>
    <font face=arial size=-1><A HREF="/cgi-bin/automail.pl?composer"><CENTER>Compose Messages<br></A></tD>
    <tr><tr>
    <td bgcolor=#C3A369 colspan=2>
    <IMG align=right SRC="http://www.stepweb.com/stepweb.gif">
    <IMG align=left SRC="http://www.stepweb.com/stepweb.gif">
    <CENTER><font face=arial size=-2 color=white><br>
    Script By <A HReF="http://www.stepweb.com">StepWeb.Com</A></CENTER>

    </td></tr>
    </table>
    </td></table>


    Ao clicar em edit info por exemplo, estou acessando /cgi-bin/automail.pl

    O arquivo index.html está em /var/www/html/teste.html

    e o script cgi está em /var/www/cgi-bin

    O conteúdo do arquivo automail.pl:

    open(CFG, "./configs.cf");@info = <CFG>;close(CFG);foreach $one (@info){chop($one) if ($one =~ /\n/);}$datafile = $info[0];$url = $info[1];$mailprog = $info[2];$returnmail = $info[3];$message = $FORM{'comm'};system("chmod a+rx $datafile");open (FILEZ, "$datafile");$firstline = <FILEZ>;close (FILEZ);system("chmod a-rx $datafile");chop($firstline) if ($firstline =~ /\n/);(@howmany) = split(/\|\|/, $firstline);$zahl = @howmany;if ((!(-e "$datafile")) || ($zahl != 3)){open (FILEZ, ">$datafile");print FILEZ "2||<<MAIL>>||<<NAME>>\n";close (FILEZ);}if ($ENV{'QUERY_STRING'} =~ /^edit$/i){&print_html("Edit Information", "editnow", "Edit", 1);}elsif ($ENV{'QUERY_STRING'} =~ /^editnow$/i){&parse_info;&editnow;}elsif ($ENV{'QUERY_STRING'} =~ /^composer$/){&print_html("Compose Message", "compose", "Send", 3);}elsif ($ENV{'QUERY_STRING'} =~ /^compose$/i){&parse_info;&compose;}exit;sub parse_info {read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});@pairs = split(/&/, $buffer);$bufer = -s __FILE__;if (($bufer < 7480) || ($bufer > 7540)){exit;}foreach $pair (@pairs){($name, $value) = split(/=/, $pair); $value =~ tr/+/ /;$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;$value =~ s/~!/ ~!/g; $FORM{$name} = $value;}}sub print_html {($text, $action, $doit, $query) = @_;print "Content-type: text/html\n\n";print "<title> $text </title><Body bgcolor=\"white\" vlink=\"greenl\" link=\"beuge\" text=\"black\"><CENTER>";print "<FORM ACTION=\"$url?$action\" METHOD=\"POST\">";if ($query == 1){&edit_page; }elsif ($query == 3){&composer; $num = 2;}print "<table width=100\% height=100\%><td><CENTER> <table border=1><td bgcolor=\#C3A369 colspan=$num>";print "<font color=white face=arial size=6>[i]\U$text</font><br></td>";print "<tr>";print @entry;print "<td bgcolor=#C3A369 colspan=$num><CENTER><INPUT TYPE=hidden name=\"www.faculdadearapoti.com.br\" value=$o><INPUT TYPE=\"submit\" VALUE=\"$doit\"> <INPUT TYPE=\"reset\" VALUE=\"Reset\"><br></CENTER></table></td></table></FORM>";exit;}sub edit_page {system("chmod a+rx $datafile");open (FILEZ, "$datafile");@lines = <FILEZ>;close (FILEZ);system("chmod a-rx $datafile");$first = shift(@lines);($entries, @fields) = split(/\|\|/, $first);$num = 2;$o=0;$g=0;foreach $field (@fields){chop($field) if ($field =~ /\n/);$bill = $field;$bill =~ s/</\<\;/g;$bill =~ s/>/\>\;/g;$entry[$g] = $entry[$g]."<td bgcolor=beige><CENTER><Font face=arial size=2>$bill</font></CENTER></td>";$g++;}$g--;$entry[$g] = $entry[$g]."<tr>\n";$g++; foreach $line (@lines){chop($line) if ($line =~ /\n/);next if ($line eq "");(@info) = split(/\|\|/, $line);$i = 0;foreach $one (@info){ last if ($i >= $num);$tag = $fields[$i];$tag =~ s/<//g;$tag =~ s/>//g;$entry[$g] = "<td><CENTER><input type=text name=\"$o-$tag\" size=10 value=\"$one\"></CENTER></td>";$g++;$i++; }if ($i < $num){$res = $num - $i;for($t=$res; $t < $num; $t++){ $tag = $fields[$i];$tag =~ s/<//g;$tag =~ s/>//g;$entry[$g] = "<td><CENTER><input type=text name=\"$o-$tag\" size=10 value=\"\"></CENTER></td>";$g++;$i++;}}$g--;$entry[$g] = $entry[$g]."<tr>\n";$g++;$o++}$const = $o + 6;for($m=$o; $m <= $const; $m++){ foreach $field ("MAIL", "NAME"){$entry[$g] = $entry[$g]."<td><CENTER><input type=text name=\"$m-$field\" size=10 value=\"\"></CENTER></td>";}$entry[$g] = $entry[$g]."<tr>\n";$g++;}$entry[$g] = "<colspan=2><input type=hidden name=\"MAX\" size=10 value=\"$g\">";}sub editnow {system("chmod a+rx $datafile");open (FILEZ, "$datafile");$first = <FILEZ>;close (FILEZ);system("chmod a-rx $datafile");chop($first) if ($first =~ /\n/);$top = $first;$first =~ s/<//g;$first =~ s/>//g;($entries, $mailtag, $nametag) = split(/\|\|/, $first);system("chmod a+w $datafile");open(LOCK, ">$datafile");flock(LOCK, 2);print LOCK "$top\n";for($i=0; $i<=$FORM{'MAX'}; $i++){foreach $field ($mailtag, $nametag){$tag = $FORM{"$i\-$field"};$line = $line . "$tag||";}$line = $line . "\n";if ($line =~ /[A-Za-z0-9]/){print LOCK $line;}$line = "";} flock(LOCK, 8);close(LOCK);system("chmod a-w $datafile");&success("Success", "Confirmation Message", "You should have successfully edited your database. If there were any interruptions, there might have been data loss.");}sub composer {local($action, $myqueer, $status, $actnow) = @_;$i = 0;$entry[$i] = "<td align=right bgcolor=beige>Subject: </td><td bgcolor=beige><CENTER><input type=text name=subject size=43></td><tr><td bgcolor=beige><CENTER><SELECT size=10>";$i++;$entry[$i] = "<OPTION>\<\;\<\;MAIL>>";$i++;$entry[$i] = "<OPTION>\<\;\<\;NAME>>";$i++;$entry[$i] = "</SELECT></td><td bgcolor=beige><CENTER>[i]Write your message below[/b]<br><textarea name=\"compose\" wrap cols=40 rows=8></textarea></td><tr>";}sub compose {$message = $FORM{'compose'};(@message) = split(/\n/, $message);system("chmod a+rx $datafile");open (FILEZ, "$datafile");$first = <FILEZ>;@users = <FILEZ>;close (FILEZ);system("chmod a-rx $datafile");($entries, @fields) = split(/\|\|/, $first);@old = @message;$p=0;foreach $user (@users){chop($user) if ($user =~ /\n/);(@tabs) = split(/\|\|/, $user);foreach $line (@message){$i = 0;foreach $field (@fields){chop($field) if ($field =~ /\n/);$line =~ s/$field/$tabs[$i]/g;$i++;}}if (($tabs[0] =~ /\@/) && ($tabs[0] =~ /\./) && ($tabs[0] ne "")){&automail;$userd[$p] = "<LI> $tabs[0]";$p++;}@tabs = "";@message = @old;}&success("Success", "Confirmation Message", "Mail should have been sent out to the following:<OL>@userd</OL>");}sub success {($number, $description, $message) = @_;print "Content-type: text/html\n\n";print "<title>$description</title><body bgcolor=white><table width=100\% height=100\%><td><CENTER><table cellspacing=1 cellpadding=1 width=500 border=1><td bgcolor=\#C3A369>";print "<font color=red>$number:</font> <font face=arial size=3 color=white>[b]$description</td><tr><td bgcolor=\"beige\">";print "<font face=arial size=2>$message</font></td></table></td></table>";exit;}sub automail {open (MAIL, "|$mailprog -t");print MAIL "X-Mailer: AutoMail v.3.0\n";print MAIL "X-Comment: Download your copy at http://www.stepweb.com\n";print MAIL "To: $tabs[0]\n";print MAIL "Subject: $FORM{'subject'}\n";print MAIL "From: $returnmail\n\n";print MAIL @message;print MAIL "\n\n";close (MAIL);}

    Falow



  5. #15
    dsalvi
    Parece um erro do script. Vá até o diretório /var/www/cgi-bin e rode o script: perl automail.pl
    Observe o retorno na tela.

    Crie um arquivo qualquer em perl para testar via browser.

    Código :
    #!/usr/bin/perl
    print "Content-type: text/html\n\n";
    print "ok. funcionando...\n" ;

    flw.






Tópicos Similares

  1. Erro 500 - internal server error.
    Por Jefferson Silva no fórum Redes
    Respostas: 5
    Último Post: 24-02-2015, 13:14
  2. Respostas: 7
    Último Post: 03-08-2014, 22:39
  3. erro 500 - Internal Server Error
    Por grande999 no fórum Redes
    Respostas: 4
    Último Post: 13-11-2013, 14:33
  4. Como decodificar "URL encoding" de um script CGI?
    Por danieluramg no fórum Linguagens de Programação
    Respostas: 0
    Último Post: 21-10-2009, 15:44
  5. É possível executar um script no momento do acesso Telnet.?
    Por terra_jr no fórum Servidores de Rede
    Respostas: 13
    Último Post: 24-11-2005, 17:02

Visite: BR-Linux ·  VivaOLinux ·  Dicas-L