#!/usr/bin/perl -Tw

#############################################################################
# reads announcements log file and displays on webpage                      #
#############################################################################

$announce_log = '/home/essenba/public_html/comments/logannouncements.txt';

use CGI;
use Fcntl;
$query = new CGI;

unless ($action = $query->param('action')) {
    $action = 'none';
}

#############################################################################
#                       Create header  	                                    #
#############################################################################
print <<"Headerinfo";
Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Log Announcements</TITLE>
<meta name="robots" content="noindex">
</HEAD>
<BODY bgcolor="#e5e5d5">
<center>
<font size="5" color="maroon"> News and Announcements for Old line Primitive Baptists</font><br><font size="3" color="maroon">(Any church related news such as: meetings,ordinations,prayer requests)</font><br>
<a href="http://www.essentialbaptistprinciples.org">Home Page</a><br><br>
</center>
<br><a  href="javascript:history.back(1)"><img border="0"  src="../images/back.gif" alt="back" width="20" height="22"align="left"></a>
<center>
<br><font face="Bell MT" size="4" color="#000000"><b>Chronological History of all Announcements</b><br> (Starting with the oldest entry)</font></center>
<br>
<center>
Headerinfo

#############################################################################
# Open non-destructively, read old entries, writeout new                    #
#############################################################################


#############################################################################
# display the chronological history log file                                #
#############################################################################

open (IN, "$announce_log") or die "Can't open $announce_log for reading: $!";
flock(IN, 1)            or die "Can't get LOCK_SH on $announce_log: $!";
while (<IN>) {
    print;
}
close IN                or die "Can't close $announce_log: $!";


print <<"Closeinfo";

</center>
</body>
</html>
Closeinfo
