Visualizzazione dei risultati da 1 a 6 su 6

Discussione: Guestbook

  1. #1

    Guestbook

    Quando aggiungo un record nel guestbook mi da questo errore:
    CGI Error
    The specified CGI application misbehaved by not returning a complete set of HTTP headers

    non so bene cosa significa ne dove ho sbagliato, mi potreste aiutare? - grazie
    Matteo
    menno.it

  2. #2
    Ciao,

    così è difficile dirlo.

    prova a posta lo script se non è troppo lungo.
    Marco Allegretti
    shishii@tiscalinet.it
    Lang: PERL, PHP, SQL.
    Linux user n° 268623 Fedora Core 10, Fedora Core 6, Debian Sarge on mips

  3. #3
    #!/usr/bin/perl
    ################################################## ############################
    # Guestbook Version 2.3.1 #
    # Copyright 1996 Matt Wright mattw@scriptarchive.com #
    # Created 4/21/95 Last Modified 10/29/95 #
    # Scripts Archive at: http://www.scriptarchive.com/ #
    ################################################## ############################
    # COPYRIGHT NOTICE #
    # Copyright 1996 Matthew M. Wright All Rights Reserved. #
    # #
    # Guestbook may be used and modified free of charge by anyone so long as #
    # this copyright notice and the comments above remain intact. By using this #
    # code you agree to indemnify Matthew M. Wright from any liability that #
    # might arise from it's use. #
    # #
    # Selling the code for this program without prior written consent is #
    # expressly forbidden. In other words, please ask first before you try and #
    # make money off of my program. #
    # #
    # Obtain permission before redistributing this software over the Internet or #
    # in any other medium. In all cases copyright and header must remain intact.#
    ################################################## ############################
    # Set Variables

    $guestbookurl = "http://www.menno.it/matteo/guestbookmf/guestbook.html";
    $guestbookreal = "http://www.menno.it/matteo/guestbookmf/guestbook.html";
    $guestlog = "http://www.menno.it/matteo/guestbookmf/guestlog.html";
    $cgiurl = "http://www.menno.it/cgi-bin/matteo/guestbook.pl";
    $date_command = "/usr/bin/date";

    # Set Your Options:
    $mail = matteob7@virgilio.it; # 1 = Yes; 0 = No
    $uselog = 1; # 1 = Yes; 0 = No
    $linkmail = 1; # 1 = Yes; 0 = No
    $separator = 1; # 1 = <hr>; 0 =


    $redirection = 0; # 1 = Yes; 0 = No
    $entry_order = 1; # 1 = Newest entries added first;
    # 0 = Newest Entries added last.
    $remote_mail = 0; # 1 = Yes; 0 = No
    $allow_html = 1; # 1 = Yes; 0 = No
    $line_breaks = 0; # 1 = Yes; 0 = No

    # If you answered 1 to $mail or $remote_mail you will need to fill out
    # these variables below:
    $mailprog = '/usr/lib/sendmail';
    $recipient = 'matteob7@virgilio.it';

    # Done
    ################################################## ############################

    # Get the Date for Entry
    $date = `$date_command +"%A, %B %d, %Y at %T (%Z)"`; chop($date);
    $shortdate = `$date_command +"%D %T %Z"`; chop($shortdate);

    # Get the input
    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

    # Split the name-value pairs
    @pairs = split(/&/, $buffer);

    foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);

    # Un-Webify plus signs and %-encoding
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ s///g;

    if ($allow_html != 1) {
    $value =~ s/<([^>]|\n)*>//g;
    }

    $FORM{$name} = $value;
    }

    # Print the Blank Response Subroutines
    &no_comments unless $FORM{'comments'};
    &no_name unless $FORM{'realname'};

    # Begin the Editing of the Guestbook File
    open (FILE,"$guestbookreal") || die "Can't Open $guestbookreal: $!\n";
    @LINES=<FILE>;
    close(FILE);
    $SIZE=@LINES;

    # Open Link File to Output
    open (GUEST,">$guestbookreal") || die "Can't Open $guestbookreal: $!\n";

    for ($i=0;$i<=$SIZE;$i++) {
    $_=$LINES[$i];
    if (//) {

    if ($entry_order eq '1') {
    print GUEST "\n";
    }

    if ($line_breaks == 1) {
    $FORM{'comments'} =~ s/\cM\n/
    \n/g;
    }

    print GUEST "$FORM{'comments'}
    \n";

    if ($FORM{'url'}) {
    print GUEST "<a href=\"$FORM{'url'}\">$FORM{'realname'}</a>";
    }
    else {
    print GUEST "$FORM{'realname'}";
    }

    if ( $FORM{'username'} ){
    if ($linkmail eq '1') {
    print GUEST " \&lt;<a href=\"mailto:$FORM{'username'}\">";
    print GUEST "$FORM{'username'}</a>\&gt;";
    }
    else {
    print GUEST " &lt;$FORM{'username'}&gt;";
    }
    }

    print GUEST "
    \n";

    if ( $FORM{'city'} ){
    print GUEST "$FORM{'city'},";
    }

    if ( $FORM{'state'} ){
    print GUEST " $FORM{'state'}";
    }

    if ( $FORM{'country'} ){
    print GUEST " $FORM{'country'}";
    }

    if ($separator eq '1') {
    print GUEST " - $date<hr>\n\n";
    }
    else {
    print GUEST " - $date

    \n\n";
    }

    if ($entry_order eq '0') {
    print GUEST "\n";
    }

    }
    else {
    print GUEST $_;
    }
    }

    close (GUEST);

    # Log The Entry

    if ($uselog eq '1') {
    &log('entry');
    }


    #########
    # Options

    # Mail Option
    if ($mail eq '1') {
    open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";

    print MAIL "Reply-to: $FORM{'username'} ($FORM{'realname'})\n";
    print MAIL "From: $FORM{'username'} ($FORM{'realname'})\n";
    print MAIL "Subject: Entry to Guestbook\n\n";
    print MAIL "You have a new entry in your guestbook:\n\n";
    print MAIL "------------------------------------------------------\n";
    print MAIL "$FORM{'comments'}\n";
    print MAIL "$FORM{'realname'}";

    if ( $FORM{'username'} ){
    print MAIL " <$FORM{'username'}>";
    }

    print MAIL "\n";

    if ( $FORM{'city'} ){
    print MAIL "$FORM{'city'},";
    }

    if ( $FORM{'state'} ){
    print MAIL " $FORM{'state'}";
    }

    if ( $FORM{'country'} ){
    print MAIL " $FORM{'country'}";
    }

    print MAIL " - $date\n";
    print MAIL "------------------------------------------------------\n";

    close (MAIL);
    }

    if ($remote_mail eq '1' && $FORM{'username'}) {
    open (MAIL, "|$mailprog -t") || die "Can't open $mailprog!\n";

    print MAIL "To: $FORM{'username'}\n";
    print MAIL "From: $recipient\n";
    print MAIL "Subject: Entry to Guestbook\n\n";
    print MAIL "Thank you for adding to my guestbook.\n\n";
    print MAIL "------------------------------------------------------\n";
    print MAIL "$FORM{'comments'}\n";
    print MAIL "$FORM{'realname'}";

    if ( $FORM{'username'} ){
    print MAIL " <$FORM{'username'}>";
    }

    print MAIL "\n";

    if ( $FORM{'city'} ){
    print MAIL "$FORM{'city'},";
    }

    if ( $FORM{'state'} ){
    print MAIL " $FORM{'state'}";
    }

    if ( $FORM{'country'} ){
    print MAIL " $FORM{'country'}";
    }

    print MAIL " - $date\n";
    print MAIL "------------------------------------------------------\n";

    close (MAIL);
    }

    # Print Out Initial Output Location Heading
    if ($redirection eq '1') {
    print "Location: $guestbookurl\n\n";
    }
    else {
    &no_redirection;
    }

    #######################
    # Subroutines

    sub no_comments {
    print "Content-type: text/html\n\n";
    print "<html><head><title>No Comments</title></head>\n";
    print "<body><h1>Your Comments appear to be blank</h1>\n";
    print "The comment section in the guestbook fillout form appears\n";
    print "to be blank and therefore the Guestbook Addition was not\n";
    print "added. Please enter your comments below.

    \n";
    print "<form method=POST action=\"$cgiurl\">\n";
    print "Your Name:<input type=text name=\"realname\" size=30 ";
    print "value=\"$FORM{'realname'}\">
    \n";
    print "E-Mail: <input type=text name=\"username\"";
    print "value=\"$FORM{'username'}\" size=40>
    \n";
    print "City: <input type=text name=\"city\" value=\"$FORM{'city'}\" ";
    print "size=15>, State: <input type=text name=\"state\" ";
    print "value=\"$FORM{'state'}\" size=15> Country: <input type=text ";
    print "name=\"country\" value=\"$FORM{'country'}\" size=15>

    \n";
    print "Comments:
    \n";
    print "<textarea name=\"comments\" COLS=60 ROWS=4></textarea>

    \n";
    print "<input type=submit> * <input type=reset></form><hr>\n";
    print "Return to the <a href=\"$guestbookurl\">Guestbook</a>.";
    print "\n</body></html>\n";

    # Log The Error
    if ($uselog eq '1') {
    &log('no_comments');
    }

    exit;
    }

    sub no_name {
    print "Content-type: text/html\n\n";
    print "<html><head><title>No Name</title></head>\n";
    print "<body><h1>Your Name appears to be blank</h1>\n";
    print "The Name Section in the guestbook fillout form appears to\n";
    print "be blank and therefore your entry to the guestbook was not\n";
    print "added. Please add your name in the blank below.

    \n";
    print "<form method=POST action=\"$cgiurl\">\n";
    print "Your Name:<input type=text name=\"realname\" size=30>
    \n";
    print "E-Mail: <input type=text name=\"username\"";
    print " value=\"$FORM{'username'}\" size=40>
    \n";
    print "City: <input type=text name=\"city\" value=\"$FORM{'city'}\" ";
    print "size=15>, State: <input type=text name=\"state\" ";
    print "value=\"$FORM{'state'}\" size=2> Country: <input type=text ";
    print "value=USA name=\"country\" value=\"$FORM{'country'}\" ";
    print "size=15>

    \n";
    print "Comments have been retained.

    \n";
    print "<input type=hidden name=\"comments\" ";
    print "value=\"$FORM{'comments'}\">\n";
    print "<input type=submit> * <input type=reset><hr>\n";
    print "Return to the <a href=\"$guestbookurl\">Guestbook</a>.";
    print "\n</body></html>\n";

    # Log The Error
    if ($uselog eq '1') {
    &log('no_name');
    }

    exit;
    }

    # Log the Entry or Error
    sub log {
    $log_type = $_[0];
    open (LOG, ">>$guestlog");
    if ($log_type eq 'entry') {
    print LOG "$ENV{'REMOTE_HOST'} - [$shortdate]
    \n";
    }
    elsif ($log_type eq 'no_name') {
    print LOG "$ENV{'REMOTE_HOST'} - [$shortdate] - ERR: No Name
    \n";
    }
    elsif ($log_type eq 'no_comments') {
    print LOG "$ENV{'REMOTE_HOST'} - [$shortdate] - ERR: No ";
    print LOG "Comments
    \n";
    }
    }

    # Redirection Option
    sub no_redirection {

    # Print Beginning of HTML
    print "Content-Type: text/html\n\n";
    print "<html><head><title>Thank You</title></head>\n";
    print "<body><h1>Thank You For Signing The Guestbook</h1>\n";

    # Print Response
    print "Thank you for filling in the guestbook. Your entry has\n";
    print "been added to the guestbook.<hr>\n";
    print "Here is what you submitted:

    \n";
    print "$FORM{'comments'}
    \n";

    if ($FORM{'url'}) {
    print "<a href=\"$FORM{'url'}\">$FORM{'realname'}</a>";
    }
    else {
    print "$FORM{'realname'}";
    }

    if ( $FORM{'username'} ){
    if ($linkmail eq '1') {
    print " &lt;<a href=\"mailto:$FORM{'username'}\">";
    print "$FORM{'username'}</a>&gt;";
    }
    else {
    print " &lt;$FORM{'username'}&gt;";
    }
    }

    print "
    \n";

    if ( $FORM{'city'} ){
    print "$FORM{'city'},";
    }

    if ( $FORM{'state'} ){
    print " $FORM{'state'}";
    }

    if ( $FORM{'country'} ){
    print " $FORM{'country'}";
    }

    print " - $date

    \n";

    # Print End of HTML
    print "<hr>\n";
    print "<a href=\"$guestbookurl\">Back to the Guestbook</a>\n"; print "- You may need to reload it when you get there to see your\n";
    print "entry.\n";
    print "</body></html>\n";

    exit;
    }

    ---------------------------------------------------------------------

    Questo è il codice contenuto nel file guestbook.pl nella cartella cgi-bin del sito.
    Era questo il codice necessario?

  4. #4
    Ciao,

    ritengo che l'errore sia qui:

    # Set Your Options:
    $mail = matteob7@virgilio.it; # 1 = Yes; 0 = No

    devi solo mettere:

    # Set Your Options:
    $mail = 1; # 1 = Yes; 0 = No

    Ciao.
    Marco Allegretti
    shishii@tiscalinet.it
    Lang: PERL, PHP, SQL.
    Linux user n° 268623 Fedora Core 10, Fedora Core 6, Debian Sarge on mips

  5. #5
    Mi da di nuovo l'errore:
    CGI Error
    The specified CGI application misbehaved by not returning a complete set of HTTP headers.

    Qui sotto inserisco il codice della pagina addguest.html magari servisse e fosse lì l'errore:
    <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns="urn:schemas-microsoft-comfficeffice" xmlns="http://www.w3.org/TR/REC-html40">
    <head>
    <link rel="File-List" href="addguest_file/filelist.xml">
    <title>menno.it - Matteo - Guestbook</title>
    <!--[if !mso]>
    <style>
    v\:* { behavior: url(#default#VML) }
    o\:* { behavior: url(#default#VML) }
    .shape { behavior: url(#default#VML) }
    </style>
    <![endif]--><!--[if gte mso 9]>
    <xml><o:shapedefaults v:ext="edit" spidmax="1027"/>
    </xml><![endif]-->
    </head>
    <body link="#00FF00" vlink="#00FF00" text="#FF00FF" bgcolor="#000000">
    <center>
    <h1><!--[if gte vml 1]><v:shapetype id="_x0000_t136"
    coordsize="21600,21600" o:spt="136" adj="10800" path="m@7,l@8,m@5,21600l@6,21600e">
    <v:formulas>
    <v:f eqn="sum #0 0 10800"/>
    <v:f eqn="prod #0 2 1"/>
    <v:f eqn="sum 21600 0 @1"/>
    <v:f eqn="sum 0 0 @2"/>
    <v:f eqn="sum 21600 0 @3"/>
    <v:f eqn="if @0 @3 0"/>
    <v:f eqn="if @0 21600 @1"/>
    <v:f eqn="if @0 0 @2"/>
    <v:f eqn="if @0 @4 21600"/>
    <v:f eqn="mid @5 @6"/>
    <v:f eqn="mid @8 @5"/>
    <v:f eqn="mid @7 @8"/>
    <v:f eqn="mid @6 @7"/>
    <v:f eqn="sum @6 0 @5"/>
    </v:formulas>
    <vath textpathok="t" o:connecttype="custom" o:connectlocs="@9,0;@10,10800;@11,21600;@12,10800"
    o:connectangles="270,180,90,0"/>
    <v:textpath on="t" fitshape="t"/>
    <v:handles>
    <v:h position="#0,bottomRight" xrange="6629,14971"/>
    </v:handles>
    <o:lock v:ext="edit" text="t" shapetype="t"/>
    </v:shapetype><v:shape id="_x0000_s1025" type="#_x0000_t136" alt="Iscrizione al Guestbook"
    style='width:550.5pt;height:51.75pt' fillcolor="#f9c" stroked="f">
    <v:fill color2="fuchsia" angle="-135" focusposition=".5,.5" focussize=""
    focus="100%" type="gradientRadial"/>
    <v:shadow on="t" color="silver" opacity="52429f"/>
    <v:textpath style='font-family:"Snap ITC";font-size:40pt;font-weight:bold;
    v-text-kern:t' trim="t" fitpath="t" string="Iscrizione al Guestbook"/>
    </v:shape><![endif]--><![if !vml]>[img]addguest_file/image001.gif[/img]<![endif]></h1>
    </center>

    <p align="center">Inserisci i tuoi dati qua sotto. Il nome e il commento
    sono obbligatori. <font size="4">Grazie!!</font>
    </p>
    <hr>
    <form method=POST action="http://www.menno.it/cgi-bin/matteo/guestbook.pl" name="guestbookmf">
    <p align="center">Il tuo nome: <input type=text name=realname size=30>

    E-Mail: <input type=text name=username size=40 value="@"> - Il
    tuo sito (o il preferito):

    <input type=text name=url size=35 value="http://">

    Città: <input type=text name=city size=31> - Età:
    <input type=text name=state size=3> - Hobby:
    <input type=text name=country size=50></p>
    <p align="center">
    Commento:

    <textarea name=comments COLS=60 ROWS=7></textarea><p align="center">
    <input type=submit> * <input type=reset>
    </form>


    <font face="Snap ITC" size="3">menno.it -
    Matteo</font></p>
    </body>
    </html>

    Nella pagina guestlog.html non c'è codice.

    é bene che mi affidi a qualche altro guestbook più facile? volevo però prima capire come funzionava uno per provare qualcosa di più personale... scusate il continuo disturbo.Grazie

  6. #6
    Ciao,

    questo è uno dei CGI più semplici.

    Ti sei accertato di avere lavorato il file con un editor che salva in puro testo?
    Hai fatto l'upload sul server in ASCII?
    Marco Allegretti
    shishii@tiscalinet.it
    Lang: PERL, PHP, SQL.
    Linux user n° 268623 Fedora Core 10, Fedora Core 6, Debian Sarge on mips

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.