search
Homephp教程php手册基于文本的留言簿

固然基数据库的留言簿可以作得很漂亮,而且也更好管理。 但是对于那些没有数据库空间的朋友们来说,基于文本的留言簿也完成可以适用于个人站来使用。而且只要我们努力去做同样可以做得很好,甚至可以说丝毫不比基于数据库的留言簿差。在这里我向介绍一个基于文本的留言簿。在下面这个地址你可以看到它的演示:http://bamboo.oso.com.cn/note.htm,它具有以下两个特点:
1.    用不同的颜我显示不同人发表的留言;
2.    每个留言者具有选择小图标的功能。
本留言簿要由以下四个文件组成:记录留言内容的note.txt文件;记录留言文字显示颜色的color.txt文件;这两个文件都可以有notepad来创建。反应留言表单的note.htm文件;最终处理留言信息的note.php文件。以下是它们的源代码:
note.htm:


===留言簿===


  
       
          你的大名:
       
          你的邮件地址:
       
          你的个人主页:
       
          你的个人主页地址:
       
          你的留言:
       
                          
            
      请选择你喜欢的图标:        
         基于文本的留言簿         
      基于文本的留言簿      
      基于文本的留言簿     
      基于文本的留言簿       
      基于文本的留言簿       
       基于文本的留言簿      
       基于文本的留言簿       
       基于文本的留言簿        
         基于文本的留言簿         
      基于文本的留言簿     
      基于文本的留言簿     
      基于文本的留言簿       
      基于文本的留言簿        
       基于文本的留言簿      
        基于文本的留言簿               
         
  
      
            
           
    查看留言
      
    
     
  
      
                     
                   
其中:nx.gif是小图标图片,你自己可以更换。
Note.php:

    if($primsg==1){
       $f = fopen("note.txt","r");
       $msg = fread($f,filesize("note.txt"));
       fclose($f);
       print "$msg";  }
    else{
          if ($name=="") {
            print "你总得给我留下的你的大名吧!否则我如何称呼你?
";}
            else if  ($note=="") {
            print "你总得说点什么吧?否则点发送干什么?不会是点错了吧?想查看留言??
";
              }
          else{
             if  ($email=="") {
            print "连电子邮件地址也不给留?我如何跟你联系?
";
                }
             else if  ($webname==""||$webadd="") {
             print "你没有个人主页?如果有还是希望你给我留下的地址,当作是宣传也可以嘛!
";
                }
              $t = date(Y年m月d日);
              $note = str_replace ( "              $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                 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";
              }
}
?>



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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.