<html>
<head>
<title>聊天室</title>
</head>
<frameset rows="*,40" border=1>
<frame src="list.php" name=list scrolling=auto>
<frame src="post.php" name=post scrolling=no>
<noframes>
<body>
本聊天室需使用页框,您的浏览器无法使用
</body>
</noframes>
</frameset>
</html>

解决方案 »

  1.   

    <?php
    // 档名: env.inc
    $tempdir="/tmp/";
    $chatfile="/tmp/abc";
    ?>
      

  2.   

    <?php
    // 档名: post.php
    require("env.inc");
    if (($chatuser!="") and ($chattext!="")) {
      $chatstr="<font color=8080ff>".date("h:i:s")."</font>-<font color=ff8080>".$chatuser."</font>: ".$chattext;
      $cmdstr="echo \"".$chatstr."\" >> ".$chatfile;
      if (!file_exists($chatfile)) passthru("touch ".$chatfile);
      passthru($cmdstr);
    }
    ?><html>
    <body bgcolor=ffffff leftmargin=0 topmargin=0 marginheight=0 marginwidth=0>
    <form action=<? echo $PHP_SELF; ?> method=post>
    <table border=0 width=100%><tr>
    <td align=right>匿称:</td>
    <td><input type=text name=chatuser size=8 value="<? echo $chatuser; ?>"></td>
    <td align=right>发言:</td>
    <td><input type=text name=chattext size=30 maxlength=500></td>
    <td><div align=right><input type=submit value="送出"></td>
    </tr></table>
    </form>
    </body>
    </html>