一个php作的文本留言本的例子(三)

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

<head>
<title>留言管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
<!--
A:link {text-decoration: none ; color:0000ff}
A:visited {text-decoration: none; color:004080}
A:active {text-decoration: none}
A:hover {text-decoration: underline; color:ff0000}
BODY {FONT-SIZE: 9p}
TH {FONT-SIZE: 9pt}
TD {FONT-SIZE: 9pt}
-->
</style>

</head>

<body bgcolor="#FFFFFF" background="back.gif">
<?
include('head.htm');
include("sys.php");
if ($password!=$managepwd and $dispflag)
  {


  echo "<meta http-equiv=Refresh content=5;url=guest.php>";
  echo "<center>";
  echo "<font color=red>密码错误!无法删除留言!</font>";
  echo "<p>程序将在3秒返回</p>";
  echo "<p> <a href=http://zihanonline.longcity.net>子汉在线</a>斑竹维护管理。</p>";
  echo "<br>";
  echo "</center>";

  exit;
  }

?>
<table width="445" border="0" align="center" bgcolor="#CCCCCC">
  <form method="post" action="manage.php">
    <?
   if ($dispflag=="show")
   {
  $content = file($guestfile);
  $count =count($content);
  $text="";
     for ($h=$count;$h>0;$h--)
         {
          $text=$text.'<tr><td>删除第'.$h."条留言:<input type=checkbox name=check$h value=$h></td></tr>nn";
          $text=$text.$content[$h-1];
          }
    echo "$text";
    }
  ?>  
    <input type=hidden name=password value=<? echo $password ?>>
    <?
  if ($submit)
  {
  if ($password!=$managepwd)
  {
  echo "<meta http-equiv=Refresh content=5;url=guest.php>";
  echo "<center>";
  echo "<font color=red>密码错误!无法删除留言!</font>";
  echo "<p>程序将在3秒返回</p>";
  echo "<p> <a href=http://zihanonline.longcity.net>子汉在线</a>斑竹维护管理。</p>";
  echo "<br>";
  echo "</center>";

  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 "<meta http-equiv=Refresh content=5;url=guest.php>";
  echo "<center>";
  echo "<p><font color=red>留言已正确删除</font></p>";
  echo "<p>程序将在3秒返回</p>";
  echo "<p> <a href=http://zihanonline.longcity.net>子汉在线</a>斑竹维护管理。</p>";
  echo "<br>";
  echo "</center>";
  exit;
  }
  }
  ?>  
    <tr>  
      <td bgcolor="#f0f0f0">  
        <p align=center>  
          <input type=submit value=删除 name=submit>
          &nbsp;&nbsp;&nbsp;&nbsp;  
          <input type=reset value=重写 name=reset>
      </td>
    <tr>  
  </form>
</table>
<?include('bottom.htm');?>
</body>
</html>
------------
未完待续...

相关文章

  • php&java(二)

    php&java(二)

    php&java(二)...
    2006-10-10
  • php 表单数据的获取代码

    php 表单数据的获取代码

    php 获取表单数据代码,后面都有详细的说明。最近的php将会让你学到更多。
    2009-03-03
  • PHP count()函数讲解

    PHP count()函数讲解

    今天小编就为大家分享一篇关于PHP count()函数讲解,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
    2019-02-02
  • PHP邮件专题

    PHP邮件专题

    PHP邮件专题...
    2006-10-10
  • 第九节 绑定 [9]

    第九节 绑定 [9]

    第九节 绑定 [9]...
    2006-10-10
  • php数据库连接时容易出错的特殊符号问题

    php数据库连接时容易出错的特殊符号问题

    在利用php来操作数据库的时候,倘若有添加,修改等操作时,需要注意的特殊字符。
    2010-09-09
  • PHP编程风格规范分享

    PHP编程风格规范分享

    本规范由 EasyChen 借鉴 SINA网络应用开发部《C++开发规范》和互动技术部《PHP4开发规范》,以及phpDocument规范 整理出的开发规范。我觉得非常不错, 适合PHP的开发,给大家参考,养成一个良好的编程风格是非常有必要的
    2014-01-01
  • php的array_multisort()使用方法介绍

    php的array_multisort()使用方法介绍

    这段时间做数据统计,产品那边要求数据能按高到低排序,想了很多方法,都不行。最后找到PHP的array_multisort()方法。虽然实现了效果,但对这个方法还是半董半董
    2012-05-05
  • 第十三节 对象串行化 [13]

    第十三节 对象串行化 [13]

    第十三节 对象串行化 [13]...
    2006-10-10
  • PHP 强制下载文件代码

    PHP 强制下载文件代码

    PHP 强制下载文件代码,任意文件下载代码,可以让任何文件都是提示下载的实现代码。
    2010-10-10

最新评论