Home  >  Article  >  Backend Development  >  Guestbook module Text-based guestbook

Guestbook module Text-based guestbook

WBOY
WBOYOriginal
2016-07-29 08:33:321385browse

Of course, a database-based guestbook can be made very beautiful, and it is also easier to manage. But for those friends who don't have database space, the text-based guestbook can also be used on personal sites. And as long as we work hard, we can do a good job, and it can even be said to be no worse than a database-based guestbook. Here I introduce a text-based guestbook. You can see its demonstration at the following address: http://bamboo.oso.com.cn/note.htm. It has the following two characteristics:
1. Use different colors to display comments posted by different people;
2. Each commenter has the ability to select a small icon.
This guestbook is composed of the following four files: the note.txt file that records the content of the message; the color.txt file that records the color of the message text; both of these files can be created with notepad. The note.htm file that reflects the message form; the note.php file that ultimately processes the message information.The following is their source code:
note.htm:


===Guestbook===

Your name:
You Your email address:
Your personal homepage:
Your personal homepage address:
Your message:

                                         
& lt; textarea rows = "2" name = "note" color = "50" & gt; & lt;/textarea & gt; ame = "icon">
 
 
< ;img border="0" src="n4.gif" width="19" height="18">


                                                             ="n8.gif" width="19" height="18">
                                                                 n9.gif" width="19" height="18"> gif" width="18" height="18">

             
              
             
                       
    
     
  
      
            
           
    查看留言
      
    
                                                                                                      
Note.php:
if($primsg==1){
$f = fopen("note.txt","r");
$msg = fread($f,filesize("note. txt"));
                                                                                                                                                                                                                                                                                          How should I call you? ??? ;";
             } (Else if ($ webname == "" "|| $ webadd =" ") {
Print" do you have no personal homepage? If you still want you to give me the address, it can be used as a publicity!
";
                }
              $t = date(Y年m月d日);
              $note = str_replace ( "<",  "<", $note);
              $note = str_replace ( ">",  ">", $note);
              $note = str_replace ( "n",  "
", $note);
              $f = fopen("color.txt","r+");
              $color1=fread($f,filesize("color.txt"));
              if($color1==0){
                $color=ff0000;}
              else if($color1==1){
                $color="0000ff";}
              else if($color1==2){
                $color="00ff00";
              }
              else if($color1==3){
                $color="000000";
              }
              if($color1>=3){
                 $color1=0;}
              else{
                 $color1+=1;
              }
              fseek($f,0);
              fputs($f,$color1);
              fclose($f);
              for($I=1;$I<=15;$I++){
                 if($I==$icon){
                   $pic=$I;
                   }
                 }
              $str=strval($pic);
              $strhtml="";
              $add="";
              $main = "$strhtml
$name    个人主页: $add$webname      ($t)

              说:$note
";
              $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";
              }
}
?>

以上就介绍了留言簿模块 基于文本的留言簿,包括了留言簿模块方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:People's Daily Online Local Leaders Message Board Use text files to create message board tips (Part 1)Next article:People's Daily Online Local Leaders Message Board Use text files to create message board tips (Part 1)

Related articles

See more