Click to See Complete Forum and Search --> : Perl or CGI guest book


Dopple
09-03-2004, 05:31 AM
Could anyone Direct me to a tuorial that teaches you how to make a guest book in CGI or Perl please.
Cheers.:D

Dopple
09-03-2004, 07:46 AM
I've found a couple of sites but I can't download them (I'm on my work computer :mad: ) Does anyone know a code that I could just copy and paste?

akadis
09-08-2004, 09:09 PM
i made it about 2 months ago, and it isn't the best, but hey, beggers can't be choosers ;)
[see attached]
p.s. if you have any questions about it.. ask :p

akadis
09-08-2004, 09:11 PM
oops didn't attach it...

see attached.... or if you cant download it...

#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;
#An example thread




print header;

print <<"HEAD";
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>My Guestbook</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<body>
HEAD


print start_html('My Guestbook :)');
my $title=param('title');
my $name=param('name');
my $comments=param('comments');

open IN, "<saved.txt";
print "Previous comments:<br />";
while (<IN>) {
unless ($_ eq "-----------------------" ) {
print $_ . "\n";
}
}
print <<"FOOTER";
Reply:
<form action="guest.pl" method="post">
Title: <br /><input type="text" name="title" size="45"><br />
Name: <br /><input type="text" name="name" size="50"><br />
Comments: <br /><textarea cols="45" rows="10" name="comments"></textarea><br />
<input type="submit" name="submit" value="submit your comment!"><br />
</form>

</body>

</html>
FOOTER

if ($name and $title and $comments ne undef) {
open OUT, ">>saved.txt";
print OUT <<"SAVE";
Title: $title <br />
Name: $name<br />
Coments: $comments<br />
-----------------------<br />
SAVE
close(OUT);
};

Dopple
09-09-2004, 03:37 AM
That looks great. So how would I get that running with my website? Would I be able to get it looking like one of my web pages? i.e with side bar, logo and links?

akadis
09-09-2004, 11:41 AM
at the moment i am at school (free band).... i will put an example of it up on my website and show you when i can (tonight?)