Alternative message _php Tutorial

Source: Internet
Author: User
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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.