A ver si me explico bien. He instalado un cgi de un libro de visitas. Tengo un par de dudas que no consigo arreglar....
- Al firmar en el libro, el CGI me lleva a una página indicandome que el mensaje es correcto y que si quiero verlo tengo que ir al libro de visitas. Me gustaría saltarme esa página y que directamente saliera el libro.
Podéis verlo aquí: http://www.rockaina.com/liburuproba/sign.htm
He intentado cambiar el cgi poniendo un metatag que me redireccione al libro de visitas pero no anda (
- Otra duda: Al publicar el mensaje en el libro de visitas, me pone la fecha pero me gustaría quitarlo, que no apareciera...
Gracias por adelantado, la verdad es que de CGI ni idea y me ha costado un montón de trabajo echarlo a andar, y bueno, ahora estoy atascado con esto
Os pego el CGI enterito, por si acaso:
Using perl Syntax Highlighting
#!/usr/bin/perl
######################################################################
# BEFORE TRYING TO EDIT THIS SCRIPT, READ THE README FILE
######################################################################
#
# Dream Catchers CGI Scripts Feel free to modify
# Book of Guests 2.0 this script to your
# Created by Seth Leonard needs, but please
# for Dream Catchers Technologies, Inc. keep this portion so
# that I get credit.
# http://dreamcatchersweb.com/scripts The same goes for
# distribution.
#
# (c)1996/1997 Dream Catchers Technologies, Inc.,
# All Rights Reserved
#
######################################################################
# ONLY EDIT THIS PART OF THE SCRIPT!!!!
$guestlocation = "http://www.rockaina.com/liburuproba/guestbook.htm";
$guestpath = "../html/liburuproba/guestbook.htm";
$cgilocation = "http://www.rockaina.com/cgi-bin/guestbook.cgi";
$mailprog = '/usr/sbin/sendmail';
$youmail = '[email protected]';
$yourname = "Rockaina";
$getdate = "/bin/date";
# DO NOT EDIT BELOW THIS LINE!!!!
#####################################################################
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
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/<!--(.|\n)*-->//g;
$value =~ s/<([^>]|\n)*>//g;
$INPUT{$name} = $value;
}
$date = `$getdate +"%A, %B %d, %Y at %T (%Z)"`;
chop($date);
&noname unless $INPUT{'name'};
open (FILE,"$guestpath");
@lines = <FILE>;
close(FILE);
open (GUEST,">$guestpath");
foreach $line (@lines) {
if ($line =~ /<!--begin-->/) {
print GUEST ("<!--begin-->\n");
print GUEST ("<b>$INPUT{'name'}</b><br>\n");
if ($INPUT{'email'}) {
print GUEST ("<a href=\"mailto:$INPUT{'email'}\">");
print GUEST ("$INPUT{'email'}</a><br>");
}
if ($INPUT{'city'}) {
print GUEST ("<b>$INPUT{'city'}, </b>");
}
if ($INPUT{'state'}) {
print GUEST ("<b>$INPUT{'state'}</b> ");
}
if ($INPUT{'country'}) {
print GUEST (" <b>$INPUT{'country'}</b><br>");
}
if ($INPUT{'howfound'}) {
print GUEST ("* $INPUT{'howfound'} *<br>");
}
if ($INPUT{'url'} ) {
print GUEST ("<a href=\"$INPUT{'url'}\">$INPUT{'title'}</a><br>");
}
if ($INPUT{'comments'}) {
$INPUT{'comments'} =~ s/\cM\n/<br>\n/g;
$mailcomments = $INPUT{'comments'};
$mailcomments =~ s/<br>//g;
print GUEST ("$INPUT{'comments'}<br>");
}
print GUEST ("-$date<hr>\n\n");
} else {
print GUEST ("$line");
}
}
close (GUEST);
open (MAIL, "|$mailprog $youmail");
if ($INPUT{'email'}) {
print MAIL ("From: $INPUT{'name'} <$INPUT{'email'}>\n");
} else {
print MAIL ("From: $INPUT{'name'}\n");
}
print MAIL ("Subject: Guestbook Signing\n\n");
print MAIL ("$INPUT{'name'} has signed your guestbook.\n\n");
print MAIL ("Here is the new entry:\n");
print MAIL ("$INPUT{'name'}\n");
if ($INPUT{'email'}) {
print MAIL ("$INPUT{'email'}\n");
}
if ($INPUT{'city'}) {
print MAIL ("$INPUT{'city'}, ");
}
if ($INPUT{'state'}) {
print MAIL ("$INPUT{'state'} ");
}
if ($INPUT{'country'}) {
print MAIL (" $INPUT{'country'}\n");
}
if ($INPUT{'howfound'}) {
print MAIL ("* $INPUT{'howfound'} *\n");
}
if ($INPUT{'url'}) {
print MAIL ("$INPUT{'title'} url: $INPUT{'url'}\n");
}
if ($INPUT{'comments'}) {
print MAIL ("$mailcomments\n");
}
print MAIL ("-$date\n");
close (MAIL);
# Send info to visitor
if ($INPUT{'email'}) {
if ($INPUT{'email'} =~ /(.*)@(.*)/) {
open (MAIL, "|-") || exec $mailprog,$INPUT{'email'} || die "Can't open $mailprog!\n";
print MAIL ("From: $yourname <$youmail>\n");
print MAIL ("Subject: Gracias\n\n");
print MAIL ("$INPUT{'name'},\n\n");
print MAIL ("Gracias por escribir en nuestro libro de visitas! ");
print MAIL ("Puedes ver tu mensaje en $guestlocation\n");
print MAIL ("Gracias de nuevo :: ROCKAINA TEAM!\n\n");
print MAIL ("- $yourname\n\n");
close (MAIL);
}
}
&htmlafter;
# Error Messages
sub noname {
print ("Content-type: text/html\n\n");
print ("<html><head><title>No Name</title></head>\n");
print ("<body><h1>You Didn't Leave Your Name...</h1>\n");
print ("You didn't add your name so your entry to the ");
print ("guestbook was not added.\n");
print ("Please add your name below.<br>\n");
print ("<INPUT method=POST action=\"$cgilocation\">\n");
print ("Your Name:<input type=text name=\"name\" size=30><br>\n");
print ("<input type=hidden name=\"email\"");
print (" value=\"$INPUT{'email'}\">\n");
print ("<input type=hidden name=\"city\" value=\"$INPUT{'city'}\">\n");
print ("<input type=hidden name=\"state\" value=\"$INPUT{'state'}\">\n");
print ("<input type=hidden name=\"country\" value=\"$INPUT{'country'}\">\n");
print ("<input type=hidden name=\"howfound\"");
print (" value=\"$INPUT{'howfound'}\">\n");
print ("<input type=hidden name=\"comments\"");
print (" value=\"$INPUT{'comments'}\">\n");
print ("<input type=submit VALUE=\"Sign Guestbook\"><hr>\n");
print ("</body></html>\n");
exit;
}
# Print Follow Up HTML
sub htmlafter {
print ("Content-Type: text/html\n\n");
print ("<html><head><title>Gracias</title></head>\n");
print ("<body><h1>Gracias por echarte una linea en nuestro libro de visitas</h1>\n");
print ("Thank you for filling in my guestbook. Your entry has ");
print ("been added.<hr>\n");
print ("Here is what you added:<br><br>\n");
print ("<b>$INPUT{'name'}</b><br>\n");
if ($INPUT{'email'}) {
print ("<a href=\"mailto:$INPUT{'email'}\">");
print ("$INPUT{'email'}</a><br>");
}
if ($INPUT{'city'}) {
print ("<b>$INPUT{'city'}, </b>");
}
if ($INPUT{'state'}) {
print ("<b>$INPUT{'state'}</b> ");
}
if ($INPUT{'country'}) {
print (" <b>$INPUT{'country'}</b><br>");
}
if ($INPUT{'howfound'}) {
print ("$INPUT{'howfound'}<br>");
}
if ($INPUT{'url'}) {
print ("<a href=\"$INPUT{'url'}\">$INPUT{'title'}</a><br>");
}
if ($INPUT{'comments'}) {
print ("$INPUT{'comments'}<br>");
}
print ("-$date<hr>");
print ("<a href=\"$guestlocation\">Back to the Guestbook</a>. \n");
print ("If you do not see your addition, hit RELOAD<br>\n");
print ("<b>Would you like a guestbook like this one? \n");
print ("Then go <a href=\"http://dreamcatchersweb.com/scripts/\">");
print ("Here</a></b></body></html>\n");
exit;
}
######################################################################
# BEFORE TRYING TO EDIT THIS SCRIPT, READ THE README FILE
######################################################################
#
# Dream Catchers CGI Scripts Feel free to modify
# Book of Guests 2.0 this script to your
# Created by Seth Leonard needs, but please
# for Dream Catchers Technologies, Inc. keep this portion so
# that I get credit.
# http://dreamcatchersweb.com/scripts The same goes for
# distribution.
#
# (c)1996/1997 Dream Catchers Technologies, Inc.,
# All Rights Reserved
#
######################################################################
# ONLY EDIT THIS PART OF THE SCRIPT!!!!
$guestlocation = "http://www.rockaina.com/liburuproba/guestbook.htm";
$guestpath = "../html/liburuproba/guestbook.htm";
$cgilocation = "http://www.rockaina.com/cgi-bin/guestbook.cgi";
$mailprog = '/usr/sbin/sendmail';
$youmail = '[email protected]';
$yourname = "Rockaina";
$getdate = "/bin/date";
# DO NOT EDIT BELOW THIS LINE!!!!
#####################################################################
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
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/<!--(.|\n)*-->//g;
$value =~ s/<([^>]|\n)*>//g;
$INPUT{$name} = $value;
}
$date = `$getdate +"%A, %B %d, %Y at %T (%Z)"`;
chop($date);
&noname unless $INPUT{'name'};
open (FILE,"$guestpath");
@lines = <FILE>;
close(FILE);
open (GUEST,">$guestpath");
foreach $line (@lines) {
if ($line =~ /<!--begin-->/) {
print GUEST ("<!--begin-->\n");
print GUEST ("<b>$INPUT{'name'}</b><br>\n");
if ($INPUT{'email'}) {
print GUEST ("<a href=\"mailto:$INPUT{'email'}\">");
print GUEST ("$INPUT{'email'}</a><br>");
}
if ($INPUT{'city'}) {
print GUEST ("<b>$INPUT{'city'}, </b>");
}
if ($INPUT{'state'}) {
print GUEST ("<b>$INPUT{'state'}</b> ");
}
if ($INPUT{'country'}) {
print GUEST (" <b>$INPUT{'country'}</b><br>");
}
if ($INPUT{'howfound'}) {
print GUEST ("* $INPUT{'howfound'} *<br>");
}
if ($INPUT{'url'} ) {
print GUEST ("<a href=\"$INPUT{'url'}\">$INPUT{'title'}</a><br>");
}
if ($INPUT{'comments'}) {
$INPUT{'comments'} =~ s/\cM\n/<br>\n/g;
$mailcomments = $INPUT{'comments'};
$mailcomments =~ s/<br>//g;
print GUEST ("$INPUT{'comments'}<br>");
}
print GUEST ("-$date<hr>\n\n");
} else {
print GUEST ("$line");
}
}
close (GUEST);
open (MAIL, "|$mailprog $youmail");
if ($INPUT{'email'}) {
print MAIL ("From: $INPUT{'name'} <$INPUT{'email'}>\n");
} else {
print MAIL ("From: $INPUT{'name'}\n");
}
print MAIL ("Subject: Guestbook Signing\n\n");
print MAIL ("$INPUT{'name'} has signed your guestbook.\n\n");
print MAIL ("Here is the new entry:\n");
print MAIL ("$INPUT{'name'}\n");
if ($INPUT{'email'}) {
print MAIL ("$INPUT{'email'}\n");
}
if ($INPUT{'city'}) {
print MAIL ("$INPUT{'city'}, ");
}
if ($INPUT{'state'}) {
print MAIL ("$INPUT{'state'} ");
}
if ($INPUT{'country'}) {
print MAIL (" $INPUT{'country'}\n");
}
if ($INPUT{'howfound'}) {
print MAIL ("* $INPUT{'howfound'} *\n");
}
if ($INPUT{'url'}) {
print MAIL ("$INPUT{'title'} url: $INPUT{'url'}\n");
}
if ($INPUT{'comments'}) {
print MAIL ("$mailcomments\n");
}
print MAIL ("-$date\n");
close (MAIL);
# Send info to visitor
if ($INPUT{'email'}) {
if ($INPUT{'email'} =~ /(.*)@(.*)/) {
open (MAIL, "|-") || exec $mailprog,$INPUT{'email'} || die "Can't open $mailprog!\n";
print MAIL ("From: $yourname <$youmail>\n");
print MAIL ("Subject: Gracias\n\n");
print MAIL ("$INPUT{'name'},\n\n");
print MAIL ("Gracias por escribir en nuestro libro de visitas! ");
print MAIL ("Puedes ver tu mensaje en $guestlocation\n");
print MAIL ("Gracias de nuevo :: ROCKAINA TEAM!\n\n");
print MAIL ("- $yourname\n\n");
close (MAIL);
}
}
&htmlafter;
# Error Messages
sub noname {
print ("Content-type: text/html\n\n");
print ("<html><head><title>No Name</title></head>\n");
print ("<body><h1>You Didn't Leave Your Name...</h1>\n");
print ("You didn't add your name so your entry to the ");
print ("guestbook was not added.\n");
print ("Please add your name below.<br>\n");
print ("<INPUT method=POST action=\"$cgilocation\">\n");
print ("Your Name:<input type=text name=\"name\" size=30><br>\n");
print ("<input type=hidden name=\"email\"");
print (" value=\"$INPUT{'email'}\">\n");
print ("<input type=hidden name=\"city\" value=\"$INPUT{'city'}\">\n");
print ("<input type=hidden name=\"state\" value=\"$INPUT{'state'}\">\n");
print ("<input type=hidden name=\"country\" value=\"$INPUT{'country'}\">\n");
print ("<input type=hidden name=\"howfound\"");
print (" value=\"$INPUT{'howfound'}\">\n");
print ("<input type=hidden name=\"comments\"");
print (" value=\"$INPUT{'comments'}\">\n");
print ("<input type=submit VALUE=\"Sign Guestbook\"><hr>\n");
print ("</body></html>\n");
exit;
}
# Print Follow Up HTML
sub htmlafter {
print ("Content-Type: text/html\n\n");
print ("<html><head><title>Gracias</title></head>\n");
print ("<body><h1>Gracias por echarte una linea en nuestro libro de visitas</h1>\n");
print ("Thank you for filling in my guestbook. Your entry has ");
print ("been added.<hr>\n");
print ("Here is what you added:<br><br>\n");
print ("<b>$INPUT{'name'}</b><br>\n");
if ($INPUT{'email'}) {
print ("<a href=\"mailto:$INPUT{'email'}\">");
print ("$INPUT{'email'}</a><br>");
}
if ($INPUT{'city'}) {
print ("<b>$INPUT{'city'}, </b>");
}
if ($INPUT{'state'}) {
print ("<b>$INPUT{'state'}</b> ");
}
if ($INPUT{'country'}) {
print (" <b>$INPUT{'country'}</b><br>");
}
if ($INPUT{'howfound'}) {
print ("$INPUT{'howfound'}<br>");
}
if ($INPUT{'url'}) {
print ("<a href=\"$INPUT{'url'}\">$INPUT{'title'}</a><br>");
}
if ($INPUT{'comments'}) {
print ("$INPUT{'comments'}<br>");
}
print ("-$date<hr>");
print ("<a href=\"$guestlocation\">Back to the Guestbook</a>. \n");
print ("If you do not see your addition, hit RELOAD<br>\n");
print ("<b>Would you like a guestbook like this one? \n");
print ("Then go <a href=\"http://dreamcatchersweb.com/scripts/\">");
print ("Here</a></b></body></html>\n");
exit;
}
Coloreado en 0.006 segundos, usando GeSHi 1.0.8.4