#!/usr/bin/perl # # showguestbook.pl v0.0.4 - Displays guestbook # Copyright (C) 2009, 2010 Stian Skjæveland # # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # use CGI qw(:standard); use strict; my ($i, $filecount, $name, $date, $message, @filelines ); print header; my $file="/home/stunix/domains/atlantiscrew.net/public_html/stian/doc/guestbook.txt"; open(GUESTBOOK, "<$file") || print "error: $!"; $filecount=@filelines=; for ($i=-1; $i<$filecount; $i--) { if (!($filelines[$i])) { exit(0); } chomp(($name, $date, $message)=split('/', $filelines[$i])); print "

$name
$date
$message

"; } close(GUESTBOOK);