Index. php
Copy codeThe Code is as follows:
<Html>
<Head> <Title>
Online Chat
</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>
</Html>
_ A. php
Copy codeThe Code is as follows:
<Html>
<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> & nbspin <font color = \" red \ "> ". $ time. "</font> & nbspsays 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 = "20">
</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" type = "codeph" text = "/codeph">
<Td align = "left">
<Table width = "100%" height = "500" boder = 0 cellspacing = 0 cellpadding = 0 bgcolor = "# EFEFEF">
<Tr align = "left">
<Td valign = "top">
<Font size = "-2" 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 = "12" maxlength = "80" value = "<? Php echo $ person;?> ">
<Br>
<Font size = "-1"> </font>
<Textarea type = "textarea" name = "message" rows = "9" cols = "150" size = 100> </textarea>
<Input type = "submit" value = "">
</Td>
</Form>
</Tr>
</Table>
</Font>
</Td>
</Tr>
</Tr>
</Table>
</Td>
</Tr>
</Table>
</Body>
</Html>
_ B. php
Copy codeThe Code is as follows:
<Html>
<Head>
<Title>
Chat Room
</Title>
</Head>
& Lt; META HTTP-EQUIV = Refresh CONTENT = "5; URL = _ B. php & gt;
<Body bgcolor = "# EFEFEF">
<? Php
$ Handle = fopen ("msg.txt", "r ");
// $ Oldmsg = array ();
While ($ content = fgets ($ handle )){
// $ Oldmsg [] = $ content;
// + + $ Tot;
Echo $ content;
}
?>
</Body>
</Html>