For PHP free personal page space does not support the user's MySQL, how to write a message board? In fact, the writing of the message board there is a very simple way, that is the way to manipulate the text file. I did a free homepage on the hip-hop, you can leave a message Oh!
Write two PHP files (note.php and result.php) plus a text file (Note.txt) that holds the message record.
Well, let's look at the example: (note.php)
<title>Little message Book</title>
Little message Book
Your name:
Email:
Message:
$f = fopen ("Note.txt", "R");
$msg = Fread ($f, FileSize ("Note.txt"));
Fclose ($f);
print "$msg";
?>
Author: Oriental snake
Home: Php Beginners ' Corner
Then, look at result.php.
if ($nickname = = "") {
Print "
What's your name?
";
}
else if ($email = = "") {
Print " Your email?
";
}
else if ($note = = "") {
Print " Don't you have anything to say?
";
}else{
Print "
";
$t = Date (y year M d Day);
$note = Str_replace ("<", "<", $note);
$note = Str_replace (">", ">", $note);
$note = Str_replace ("n", "
", $note);
$main = "Online name: $nickname:($t)
Message: $note
";
$f = fopen ("Note.txt", "a");
Fwrite ($f, $main);
Fclose ($f);
Print " Thank you for your message!
";
}
?>
Return
Author: Oriental snake
Home: Php Beginners ' Corner
http://www.bkjia.com/phpjc/532097.html Span id= "Indexurl" itemprop= "Indexurl" >www.bkjia.com true http://www.bkjia.com/phpjc/532097.html techarticle For PHP free personal page space does not support the user's MySQL, how to write a message board? In fact, the writing of the message board there is a very simple way, that is to manipulate the text file side ...