<?php
$submit = $_POST["submit"];
$name = $_POST["name"];
$email = $_POST["email"];
$url = $_POST["url"];
$comment = $_POST["comment"];
$low_num = $_REQUEST["low_num"];
$high_num = $_REQUEST["high_num"];
$name = ereg_replace("[^A-Za-z ]", "", $name);
$email = ereg_replace("[^A-Za-z 0-hide@address.com]", "", $email);
$comment = ereg_replace('[^A-Za-z 0-9?!.,:/\@<>#$[](){}]', "", $comment);
$url = eregi_replace("http://", "", $url);
$url = ereg_replace("[^A-Za-z 0-9\.-_/\]", "", $url);
$name = stripslashes($name);
$email = stripslashes($email);
$website = stripslashes($url);
$comment = stripslashes($comment);
$file = "entries.html";
$date = (date ("l, dS F Y [h:i:s A]",time()));
$ip = $_SERVER['REMOTE_ADDR'];
$spilter = "<!---->";
$format = "<b>Name: </b>$name<br><b>Email: </b><a href=\"mailto:$email\">$email</a><br><b>Website: </b><a href=\"http://$url\" target=\"_blank\">$url</a><br><b>Comments:</b><br>$comment<br><b>Date:</b> $date<br><b>IP: </b>$ip<br><br>";
if ($submit == "yes")
{
$fp= fopen( $file,"r");
$old_data= fread($fp, 80000);
fclose( $fp);
$write="$format$spilter$old_data";
$fp=fopen( $file, "w");
if(!$fp) die("&entries=Sorry! Failed to write down your comment.");
fwrite($fp, $write, 800000);
fclose( $fp );
}
$fp=fopen( $file, "r");
$data=fread($fp, 800000);
fclose( $fp );
$data_array=split ("$spilter", $data);
$entries_count=count($data_array) - 1;
print "&total_entries=$entries_count&low_num=$low_num&high_num=$high_num&entries=";
for ($number = $low_num; $number < $high_num; $number++) {
print $data_array[$number];
if (!$data_array[$number]) {
Print "<br><br><b>No more entries</b>";
exit;
}
}
?>