surely. also, its began kicking back this:
Warning: fread(): Length parameter must be greater than 0. in /home/u1/kgaard/html/testing/works.php on line 48
it works ok with the first section, but when i copy and paste it again the error occurs. thanks for all your help - sorry, i'm kinda new at this.
<?PHP
$month = $_POST['month'];
$day = $_POST['day'];
$year = $_POST['year'];
if ($_POST['mode']!="") {$mode=$_POST['mode'];}else{$mode=$_GET['mode'];}
$event1_details=$_POST['event1_details'];
$filelocation = $month.$day.$year.'event1_details.txt';
if (!file_exists($filelocation)) {
echo "Error! Couldn't find this date's file, please contact administrator!";
}
else {
$newfile = fopen($filelocation,"r");
$content = fread($newfile, filesize($filelocation));
fclose($newfile);
}
$content = stripslashes($content);
$content = htmlentities($content);
$pass="edit";
if (!$mode || $mode != $pass){
$content = nl2br($content);
echo $content;
}
else {
if ($event1_details){
$event1_details = stripslashes($event1_details);
$newfile = fopen($filelocation,"w");
fwrite($newfile, $event1_details);
fclose($newfile);
echo "Event Details Were Saved.<form><input type=\"submit\" value=\"confirm changes\"></form>";
}
else{
print 'Please Enter Event 1 Details';
echo "<form method=\"post\">
<textarea name=\"event1_details\" cols=50 rows=15 wrap=\"virtual\">";
echo'&details1=';
echo $content;
echo "</textarea><input type=\"hidden\" name=\"mode\" value=\"$pass\"><br><input type=\"submit\" value=\"SAVE\"></form>";
}}
if ($_POST['mode']!="") {$mode=$_POST['mode'];}else{$mode=$_GET['mode'];}
$event1_headline=$_POST['event1_headline'];
$filelocation1 = $month.$day.$year.'event1_headline.txt';
if (!file_exists($filelocation1)) {
echo "Error! Couldn't find this date's file, please contact administrator!";
}
else {
$newfile1 = fopen($filelocation1,"r");
$content1 = fread($newfile1, filesize($filelocation1));
fclose($newfile1);
}
$content1 = stripslashes($content1);
$content1 = htmlentities($content1);
$pass="edit";
if (!$mode || $mode != $pass){
$content1 = nl2br($content1);
echo $content1;
}
else {
if ($event1_headline){
$event1_headline = stripslashes($event1_headline);
$newfile1 = fopen($filelocation1,"w");
fwrite($newfile1, $event1_headline);
fclose($newfile1);
echo "Event Details Were Saved.<form><input type=\"submit\" value=\"confirm changes\"></form>";
}
else{
print 'Please Enter Event 1 Details';
echo "<form method=\"post\">
<textarea name=\"event1_headline\" cols=50 rows=15 wrap=\"virtual\">";
echo'&details1=';
echo $content1;
echo "</textarea><input type=\"hidden\" name=\"mode\" value=\"$pass\"><br><input type=\"submit\" value=\"SAVE\"></form>";
}}
?>