index.php
Copy Code code as follows:
Chat online
</title><!--frames-->
<frameset rows= "70%,*" border= "0" >
<frame name= "Top" src= "_b.php" marginwidth= "0" marginheight= "0" scrolling= "yes" frameborder= "NO" noresize>
<frame name= "Bottom" src= "_a.php" marginwidth= "0" marginheight= "0" scrolling= "no" frameborder= "no" noresize>
</frameset>
<body>
</body>
_a.php
Copy Code code as follows:
<title>
Chat room
</title>
<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 >
<?php
$person = @$_post[person];
$msg = @$_post[message];
if ($person!= "" && $msg!= "") {
$handle = fopen ("Msg.txt", "R");
$tot = 0;
$oldmsg = Array ();
while ($content = fgets ($handle)) {
$oldmsg [] = $content;
+ + $tot;
}
Fclose ($handle);
Unlink ("Msg.txt");
$fp = fopen ("Msg.txt", "A +");
$time = Date ("H:i");
Fwrite ($fp, "<font color=\" blue\ ">". $person. " </font> in <font color=\ "red\" > ". $time." </font>  says that <b> ". $msg." </b><br> "." \ n ");
for ($i =0; $i < $tot; + + $i) {
if ($i >50) break;
Fwrite ($fp, $oldmsg [$i]);
}
}
?>
<table width= "100%" border= "0" cellspacing= "0" cellpadding= "0" >
<tr align= "left" bgcolor= "#666666" >
<TD height= ">"
</td></tr>
<tr bgcolor= "#FFCC66" >
<TD width= "1" height= "4" ></td>
</tr>
</TABLE>
<table width= "100%" border=0 cellspacing=0 cellpadding=0 bgcolor= "#EFEFEF" >
<tr bgcolor= "#666666" >
<TD align= "Left" >
<table width= "100%" height= "boder=0 cellspacing=0 cellpadding=0 bgcolor=" #EFEFEF ">
<tr align= "Left" >
<TD valign= "Top" >
<font size= "-1" color= "#666666" >
<table width = "100%" border = "0" >
<tr>
<form action= "_a.php" method = "POST" >
<TD align= "Left" >
<font size= "-1" > Nickname:</font>
<input type= "text" name= "person" size= "maxlength=" "value=" <?php echo $person;? > ">
<br>
<font size= "-1" ></font>
<textarea type= "textarea" name= "message" rows= "9" cols= "the" size = 100></textarea>
<input type= "Submit" value= "speech" >
</td>
</form>
</tr>
</table>
</font>
</td>
</tr>
</tr>
</table>
</td>
</tr>
</table>
</body>
_b.php
Copy Code code as follows:
<title>
Chat room
</title>
<meta Http-equiv=refresh content= "5; Url=_b.php ">
<body bgcolor= "#EFEFEF" >
<?php
$handle =fopen ("Msg.txt", "R");
$oldmsg = Array ();
while ($content = fgets ($handle)) {
$oldmsg [] = $content;
+ + $tot;
Echo $content;
}
?>
</body>