Text-based guest book

Source: Internet
Author: User
Although the base database of the guest book can be very beautiful, but also better management. But for friends who don't have database space, text-based guest books can also be applied to individual stations. And as long as we work hard to do the same can be done well, even can be said in the slightest less than based on the database of the guest book poor. I'm here to introduce a text-based guest book. In this address you can see its demo: http://bamboo.oso.com.cn/note.htm, which has the following two features:
1. With different Yan I show different people posted messages;
2. Each message has the ability to select a small icon.
This guest book should consist of the following four files: Record the Note.txt file of the message content, record the Color.txt file with the color of the message text, and all the two files can be created by Notepad. note.htm file of Reaction message form, note.php file of final processing message information. The following are their source code:
Note.htm:
<title>=== Guest Book ===</title>
<body>
<form method= "POST" action= "note.php" >
Your name: <input type= "text" name= "name" size= "><br>"
Your email address: <input type= "text" name= "email" size= "><br>"
Your personal homepage: <input type= "text" name= "WebName" size= "><br>"
Your personal homepage address: <input type= "text" name= "Webadd" size= "><br>"
Your message:<br>.

<textarea rows= "2" name= "note" cols= "></textarea>"
Please choose the icon you like:
<input type= "Radio" value= "1" checked name= "icon" >
<input type= "Radio" name= "icon" value= "2" >
<input type= "Radio" name= "icon" value= "3" >
<input type= "Radio" name= "icon" value= "4" >
<input type= "Radio" name= "icon" value= "5" >
<input type= "Radio" name= "icon" value= "6" >
<input type= "Radio" name= "icon" value= "7" >
<input type= "Radio" name= "icon" value= "8" >
<input type= "Radio" name= "icon" value= "9" >
<input type= "Radio" name= "icon" value= "ten" >
<input type= "Radio" name= "icon" value= "one" >
<input type= "Radio" name= "icon" value= "" >
<input type= "Radio" name= "icon" value= "" >
<input type= "Radio" name= "icon" value= "" >
<input type= "Radio" name= "icon" value= "" >
</div>
<div align= "Left" >

<input type= "Submit" value= "send" Name= "B1" ><input type= "reset" value= "rewrite" name= "B2" >
<a href= "note.php?primsg=1" > View message </a><br>
</div>
</form>
</body>
Where: Nx.gif is a small icon picture, you can replace it yourself.
note.php:
?
if ($primsg ==1) {
$f = fopen ("Note.txt", "R");
$msg = Fread ($f, FileSize ("Note.txt"));
Fclose ($f);
print "$msg"; }
else{
if ($name = = "") {
Print "You have to leave me your name!" How else would I call you? <br> ";}
else if ($note = = "") {
Print "You gotta say something, right?" Otherwise, what is the point of sending? Isn't that a bit of a mistake? Want to view message??<br> ";
}
else{
if ($email = = "") {
Print "Don't even leave your email address?" How can I get in touch with you? <br> ";
}
else if ($webname = = "" | | $webadd = "") {
Print "You don't have a personal homepage?" If there is or want you to leave me the address, as a propaganda also can! <br> ";
}
$t = Date (Y-year m-month D-day);
$note = Str_replace ("<", "<", $note);
$note = Str_replace (">", ">", $note);
$note = Str_replace ("\ n", "<br>", $note);
$f = fopen ("Color.txt", "r+");
$color 1=fread ($f, FileSize ("Color.txt"));
if ($color 1==0) {
$color =ff0000;}
else if ($color 1==1) {
$color = "0000FF";}
else if ($color 1==2) {
$color = "00FF00";
}
else if ($color 1==3) {
$color = "000000";
}
if ($color 1>=3) {
$color 1=0;}
else{
$color 1+=1;
}
Fseek ($f, 0);
Fputs ($f, $color 1);
Fclose ($f);
For ($I =1 $I <=15; $I + +) {
if ($I = = $icon) {
$pic = $I;
}
}
$str =strval ($pic);
$strhtml = " ';
$add = "<a href=". $webadd. " ></a> ";
$main = "$strhtml <br><font color= $color ><a href=\" mailto: $email \ "> $name </a> &nbsp Personal homepage: $ Add$webname</a> ($t) <br>
said: $note <br> ";
$f = fopen ("Note.txt", "a");
Fwrite ($f, $main);
Fclose ($f);
$f = fopen ("Note.txt", "R");
$msg = Fread ($f, FileSize ("Note.txt"));
Fclose ($f);
echo "$msg";
}
}
?>


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.