#!/usr/local/bin/php
$Submit = $_REQUEST['Submit'];
$Name = $_REQUEST['Name'];
$Email = $_REQUEST['Email'];
$Website = $_REQUEST['Website'];
$Comments = $_REQUEST['Comments'];
$bio = $_REQUEST['bio'];
$NumHigh = $_REQUEST['NumHigh'];
$NumLow = $_REQUEST['NumLow'];
$Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
$Comments = ereg_replace("<", "%26lt;", $Comments);
$Comments = ereg_replace(">", "%26gt;", $Comments);
$Comments = ereg_replace("&", "%26amp;", $Comments);
$Comments = ereg_replace("\n", "
", $Comments);
$Comments = ereg_replace("\r", "
", $Comments);
$Website = eregi_replace("http://", "", $Website);
$Website = ereg_replace("[^A-Za-z0-9 \@\.\-\/\'\~\:]", "", $Website);
$Name = stripslashes($Name);
$Email = stripslashes($Email);
$Website = stripslashes($Website);
$Comments = stripslashes($Comments);
####################################################################################
########### Reading and Writing the new data to the devlog #############
if ($Submit == "Yes") {
#Next line tells the script which Text file to open.
$filename = $bio."/devlog.txt";
#Opens up the file named above for reading
$fp = fopen( $filename,"r");
$OldData = fread($fp, 80000);
fclose( $fp );
#Gets the current Date of when the entry was submitted
$Today = (date ("l dS of F",time()));
#Puts the recently added data into html format that can be read into the Flash Movie.
$Input = "Name: $Name
Email: $Website
Message:
$Comments
Date: $Today
.:::.";
#This Line adds the 'devlog=' part to the front of the data that is stored in the text file. This is important because without this the Flash movie would not be able to assign the variable 'devlog' to the value that is located in this text file
$New = "$Input$OldData";
#Opens and writes the file.
$fp = fopen( $filename,"w+");
fwrite($fp, $New, 80000);
fclose( $fp );
}
####################################################################################
########## Formatting and Printing the Data from the devlog file to the Flash Movie ##
#Counts the Number of entries in the devlog
#Next line tells the script which Text file to open.
$filename = $bio."/devlog.txt";
#Opens up the file declared above for reading
$fp = fopen( $filename,"r");
$Data = fread($fp, 80000);
fclose( $fp );
#Splits the Old data into an array anytime it finds the pattern .:::.
$DataArray = split (".:::.", $Data);
$NumEntries = count($DataArray) - 1;
print "&TotalEntries=$NumEntries&NumLow=$NumLow&NumHigh=$NumHigh&devlog=";
for ($n = $NumLow; $n < $NumHigh; $n++)
{
if(($n == $NumLow) && (!$DataArray[$n]))
{
print "No entries";
exit;
}
if($n < $NumEntries)
{
print $DataArray[$n];
}
}
####################################################################################
############### End devlog script
?>