#!/usr/bin/perl

# Ouvrir le fichier
$i=0;
if (open (FICHIER, "<gbooks.txt") != false)
{
#  flock (FICHIER, 1);              # verrouille en lecture
  $max=0;
  while (<FICHIER>)
  {
    push(@Lignes,$_);
    $max++;
  }
#  flock (FICHIER, 8);              # déverrouille
  close (FICHIER);

# Sortie vers le navigateur :
print "Content-type: text/html\n\n";
print <<html_fin;
<HTML>
<HEAD>
     <TITLE>The Eurofil Homepage, Guestbook entries.</TITLE>
<style type="text/css">
a:link    {text-decoration:underline; color:#990000;}
a:visited {text-decoration:underline; color:#990000;}
a:hover   {text-decoration:underline;color:green;}
body      {margin-left:20pt;}
hr        {color:red;}
td        {border-style:dotted; border-color:green; border-width:3px;font-size:9pt;}

body      { scrollbar-arrow-color: #000000;
	      scrollbar-base-color: #ff9440;
	      scrollbar-highlight-color: #ff9440;
	      scrollbar-light-shadow-color:#a4de00;
	      scrollbar-track-color:#ff9440;}



</style>

<base target="_blank"
</HEAD>

<BODY bgcolor="#ff9440" text="#990000" link="red" vlink="red" alink="red">

<div align="center">

<H3><font face="Comic Sans Ms">Ethel's Web Guestbook messages:</font></font></H3></div><BR>
html_fin

  for ($i=0; $i<$max; $i+=6)
   {
    $time = @Lignes[$i+0];
    $PNom = @Lignes[$i+1];
    $NomFam = @Lignes[$i+2];
    $email = @Lignes[$i+3];
    $subject = @Lignes[$i+4];
    $body = @Lignes[$i+5];

    print "<B><table border=2 width=350 align=center cellpadding=18><tr><td bgcolor=#ffba68>", $PNom, " from ", $NomFam,"</B><BR>\n";
    print "</B> (<B><A HREF=\"mailto:",
      $email, "\">", $email, "</A></B>)<BR><BR>\n";
    print "Date:<B>", $time,"<BR><BR>\n";
    print "</B> <B><A HREF=\"",
      $subject, "\">", $subject, "</A></B><BR><BR>\n";
    print "<font face=Verdana,Arial>", $body, "</font></td></tr></table></table>\n";
  }

print <<html_fin;

<br><a name=1>
<br>

<div align="center">

<font face="Verdana,Arial" size="2">

If you want you can <a href="../guestbook.html" target="ethel">sign the Guestbook</a> or go back to  <a href="http://www.ethelworld.com/" target="_top">Ethel's Web</a> 
</font>
</font>

<br>
<br>
<font size="2">Powered by: <a href="http://www.ethelworld.com" target="_top">www.ethelworld.com</a>
</div>


</BODY>
</HTML>
html_fin
}
else      # erreur fichier
{
print <<html_fin;
<HTML>
<HEAD>
     <TITLE>Erreur</TITLE>
</HEAD>

<BODY>

<B>Impossible de lire le Livre d'or</B> <P>





</BODY>
</HTML>
html_fin
}
exit;
