#!e:/programme/perl/bin/perl.exe -w
#gb.cgi - Gästebuch
use strict;
use warnings;
use CGI qw %:standard escape escapeHTML%;
use CGI::Carp qw %fatalsToBrowser%;
my $datei = "gb.txt";
my @seite;
my $aktion = param ("aktion");
print "
Gästebuch
";
if ($aktion eq "") {
open(FH, "$datei") or die "Fehler beim oeffnen von $datei: $!";
print "";
if (@seite) {
for (@seite) {
next if $_ eq "####
";
print "$_
";
}
print "
";
}
else {
print "Noch keine Einträge vorhanden
";
close FH;
print "";
}
elsif ($aktion eq "eintrag") {
print "
";
print "zurück";
}
elsif ($aktion eq "new") {
open(FH, "> $datei") or die "Fehler beim oeffnen von $datei: $!";
print "Name: | " . param ("name") . " |
":
print "E-Mail: | " . param ("email") . " |
";
print "Homepage: | " . param ("homepage") . " |
";
print "Wohnort: | " . param ("Wohnort") . " |
";
print "Nachricht: | " . param ("nachricht") . " |
";
print "
| ";
print "####
";
close FH;
open(FH, "$datei") or die "Fehler beim oeffnen von $datei: $!";
print "";
while () {
next if $_ eq "####
";
print "$_
";
}
close FH;
print "
";
print "Schreib mir!";
}
print "";
exit 0;