Я сохранаю мои сообшении в тектавом файле
Вот Так
| Цитата |
<?session_start(); error_reporting(0); $file=fopen("chat.txt","a"); fwrite($file,date("H:i")." <B>[".$_SESSION["login"]."]</B> ".$message."\n");
header("Location:send.php?login=".$_SESSION["login"]); ?>
|
А вот так они отображаютса:
| Цитата |
<? require("key.php"); ?> <html>
<script type="text/javascript"> <!-- setTimeout("getMessages()",8000);
function getMessages() { window.location.reload(); parent.frames['chating'].document.getElementById("txt1").innerHTML=document.getElementById("txt").innerHTML } //--> </script>
<body onload="scroll(0,65000)" link="blue" alink="blue" vlink="blue"> <font size=2 face="MS Sans Serif, Arial, Tahoma,sans-serif"> <span id="txt"> <?
$file=file("chat.txt"); $count=count($file);
$num=20;
if ($count>$num) { for ($i=($count-$num); $i<$count; $i++) { $str .=$file[$i]; $str=ereg_replace("rn","n",$str); }
$fp=fopen("chat.txt","w"); fwrite($fp,$str); }
$file=file("chat.txt"); $count=count($file);
for ($i=0; $i<$count; $i++) { echo $file[$i]."<br>"; }
?> </span> </font> </body> </html>
|
|