<?php

include("config.php");

$tn=date("H:i:s",time());

 include("header.php");
 print '</p>';

print '<p align="center"><img src="'.$image.'" alt="'.$site.'"/>';
print "<br/></p>";
print "<p><small><small>SING IN OUR GUESTBOOK NOW !<br/>&#171;<a href=\"say.php\">WRITE NEW</a></small></small><br/>
------------</p> ";

  $xfile = @file("gb.txt");
 $total=count($xfile);


   if ($npage == ""){$npage = "1";}
  $first = count($xfile) - ($p * ($npage - 1));
  $second = count($xfile) - ($p * $npage) + 1;
  if ($second < 1) {$second = 1;}
  $npages = (int)(count($xfile) / $p);
  if ($news_limiter>((int) ($npages*$p))) $npages = $npages+1;
  if ($npage <= $npages and $npage>1) $gline_rew = "<small><small><a href=\"history.php?npage=".($npage-1)."\">&lt; Prev</a></small></small>";
  if ($npages > 1 and $npage<$npages) $gline_next = "<small><small><a href=\"history.php?npage=".($npage+1)."\">Next &gt;</a></small></small>";

  for ($i = $first-1; $i >= $second-1; $i--)
  {
   $ii = $i;
   $ii++;
   $udata = explode("::",$xfile[$i]);
   $udata[4] = ereg_replace(" ", "", $udata[4]);
   $udata[4]=substr(trim($udata[4]),0,30);
    $udata[0]=substr(trim($udata[0]),0,30);



    $udata[1] = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
    '<a href="\\1">\\1</a>', $udata[1]);
    $udata[1] = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)',
    '\\1<a href="http://\\2">\\2</a>', $udata[1]);






      $dt = explode (',', $udata[2]);
      $this_day=(date(" j F Y"));
      $dt2 = explode (' ', $udata[2]);
      if($dt[1]==$this_day){$udata[2]="$dt2[0] <b>Today</b>";}else{}

   print "<p><small><small>$udata[2]<br/>Name: <b>$udata[0]</b><br/>";
   $e=$udata[4];
   if ($e==""){}else{
    $udata[4] = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})',
    '<a href="mailto:\\1">\\1</a>', $udata[4]);
   print "Email: $udata[4]<br/>"; }
   print "Phone: $udata[3]<br/>Message: $udata[1]</small></small><br/>$line2</p>";
   }



   print "<p>";
  print $gline_rew."|".$gline_next."";
  print "</p>";
   print "<p>$line2<br />
  <small><small>&#171; <a href=\"".$url."\">BACK</a><br />


  <br/>$total Messages</small></small>
";
  include("footer.php");
?>