PHP+TEXT guestbook (5)_PHP tutorial

WBOY
Release: 2016-07-13 17:44:02
Original
735 people have browsed it

现在我们来讲一下reply.php的代码:
---------------------------------
//reply.php


function check_strlen_long($txt)
{
$len=strlen($txt);
$count=0;
for ($i=0;$i<$len;$i++)
{
if (ord($txt[$i])<128)
{ $count=$count+1;}
if (ord($txt[$i])==10 or ord($txt[$i])==32)
{$count=0;}
if ($count>=60)
  {
  $txt[$i]="n";
  $count=0;
  }
}
  return $txt;
}

function encode ($txt)
{
$txt=strip_tags($txt);
$txt=htmlspecialchars($txt);
$message=StripSlashes($txt);
return $message;
}

  $content=file("guest.txt");
  $disptext=$content[$record-1];
 
if ($job=="addreply" and $replyname!="" and $replycontent!="")
{
$content=file("guest.txt");
$count=count($content);
$time = date(Y年m月d日H小时i分);
$ip=$REMOTE_ADDR;
$replycontent=StripSlashes($replycontent);
$replyname=encode($replyname);
$replycontent=htmlspecialchars($replycontent);
  $replycontent=check_strlen_long($replycontent);
$replycontent=nl2br($replycontent);
$replycontent=ereg_replace(chr(10),"",$replycontent);
$content[$record-1]=substr($content[$record-1],0,strlen($content[$i])-1); $content[$record-1]=$content[$record-1]."



 
 
   
            if ($Submit)
       {
        if ($replyname=="" or $replycontent=="")
        {
      echo" ";
      echo"";
      echo"";
       }
       }
      ?>
     
     
       
     
     
       
     
     
       
     
     
       
     
   
   
";
      echo "出错了回复人姓名和回复内容必填-www.devdao.com!";
      echo"
回复大名
         
       

         

回复内容


         

         
       

         
          >
         
             
         
       
 
          



------------------

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478791.htmlTechArticle现在我们来讲一下reply.php的代码: --------------------------------- //reply.php ? function check_strlen_long($txt) { $len=strlen($txt); $count=0; for ($i=0;$i$len;$i++) {...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!