Home  >  Article  >  Backend Development  >  PHP+TEXT guestbook (1)_PHP tutorial

PHP+TEXT guestbook (1)_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:43:55982browse

大家知道,数据库对于网络来说的重要性.由于cgi的复杂,现在asp和php+MySQL已经成为主流.几乎所有的个人网页都要用到留言本,可是申请的留言本很不稳定.这为网上的交流带来了诸多不便.所以,希望拥有自己的留言本的朋友越来越多.
但是,免费的个人主页支持asp和php的很少.笔者现在向您推荐动站指南,(http://www.knowsky.com)支持php.这样您便有了能够拥有自己留言本的基础.现在,我就通过一个文本留言本的例子来讲述php的简单使用.


    首先,我们先确定,留言的几个过程:写留言,发送,查看.(搜索)等等.而且对于斑竹来说,管理留言本又是不可或缺的.这样我们就不妨定位于6个php文件,1个文本文件.6个php文件分别为:guest.php manage.php reply.php sys.php del.php edit.php,1个文本文件为:guest.txt


先来看看guest.php的内容,你当然可以直接将下面的内容放到您的php网页里,请尊重作者的劳动,谢谢.
----------------------
//guest.php:

require("sys.php");
if ($B1)
{
if ($message=="" or $name=="")
{
$errorm="出错了!!!姓名和留言内容必填";
  }
  else
{
#写入数据
$space = " ";
$time = date(Y年m月d日H小时i分);
$ip=$REMOTE_ADDR;
$name=encode($name);
$homepage=encode($homepage);
$from=encode($from);
$email=encode($email);
$message=StripSlashes($message);
$message=htmlspecialchars($message);
$message=check_strlen_long($message);
$message=nl2br($message);
$guestcontent = "留言内容:




 
 
   
            if ($errorm)
      {
      echo "";
      echo "";
      echo "";
      }
      ?>
     
       
       
     
     
       
       
     
     
       
       
     
     
       
       
     
     
       
     
     
       


";
      echo "$errorm";
      echo "
姓名(必填)
         
         
主页:
         
       
来自:
         
       
Email:
         
         

         
请留言(必填)

           
           

       

         

           
           
           
           




  

  


http://www.bkjia.com/PHPjc/478795.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478795.htmlTechArticleEveryone knows the importance of databases for the Internet. Due to the complexity of cgi, asp and php+MySQL have now It has become mainstream. Almost all personal web pages use guest books, but the application messages...
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