Home >Backend Development >PHP Tutorial >PHP+TEXT guestbook (3)_PHP tutorial

PHP+TEXT guestbook (3)_PHP tutorial

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

上两节我针对guest.php和edit.php作了讲述.需要注意的是php和html的区别:
php通常是-->(1)
            (2) echo("zihanonline");
?>
            (3)
            (4)<% echo("zihanonline");%>
等4种方式.不要混淆.
下面我们来研究信息管理:manage.php代码.
-----------
//manage.php


留言管理


include(head.htm);
include("sys.php");
if ($passWord!=$managepwd and $dispflag)
{


echo "";
  echo "

";
  echo "密码错误!无法删除留言!";
  echo "

程序将在3秒返回

";
  echo "

子汉在线斑竹维护管理。

";
  echo "
";
  echo "
";

  exit;
  }

?>


 
    if ($dispflag=="show")
{
$content = file($guestfile);
$count =count($content);
$text="";
for ($h=$count;$h>0;$h--)
         {
          $text=$text.nn";
          $text=$text.$content[$h-1];
          }
    echo "$text";
    }
  ?>
    >
    if ($submit)
{
if ($password!=$managepwd)
{
echo "";
  echo "
";
  echo "密码错误!无法删除留言!";
  echo "

程序将在3秒返回

";
  echo "

子汉在线斑竹维护管理。

";
  echo "
";
  echo "
";

  exit;
  }
 
  if ($password==$managepwd)
  {
  $guest_content=file($guestfile);
  $count=count($guest_content);
  for ($j=1;$j<=$count;$j++)
{
$del_rec_num="check".$j;
$del_num=$$del_rec_num;
//echo "$del_num:$del_num";
$guest_content[$del_num-1]="";
}

  $fp=fopen($guestfile,"w");
  for ($i=0;$i<=$count-1;$i++)
  {
  if ($guest_content[$i]!="")
   {
   fputs($fp,$guest_content[$i],strlen($guest_content[$i]));
   }
  }
  fclose($fp);
  echo "";
  echo "

";
  echo "

留言已正确删除

";
  echo "

程序将在3秒返回

";
  echo "

子汉在线斑竹维护管理。

";
  echo "
";
  echo "
";
  exit;
  }
  }
  ?>
   
     
   
 
删除第.$h."条留言:

       


         
              
         
     





------------
未完待续...

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/478793.htmlTechArticle上两节我针对guest.php和edit.php作了讲述.需要注意的是php和html的区别: php通常是--(1)? echo("zihanonline");? (2)? php echo("zihanonline"); ? (3)script laangua...
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