php messageboard script

O

old.Harrydb

Guest
I'm trying to make a messageboard in php using the following code which doesnt work. can anybody tell me what I am doing wrong?

<?php

$message .="Name: $TheName \n";
$message .="Message: $TheMessage \n";
$message .="----------------------------- \n";

if ($message)
{
if ($fp = fopen ("messages.txt", "r"))
{
$oldmessages = fread($fp,filesize("messages.txt"));
fclose($fp);
}
$fp = fopen ("messages.txt", "w");
fwrite ($fp, $message);
fwrite ($fp, $oldmessages);
fclose ($fp);
}

if (file_exists("messages.txt")){
Header("Location: main.php?file=welcome.php");
}

?>
 

Users who are viewing this thread

Top Bottom