Размер файла: 916B
<?
include '../config.php';
include '../include/head.php';
if(!isset($login)) $out='Ваш ник <input name="login"><input type=submit value=Вход>';
else
{
$list=file($file='../data/chat.dat');
if(isset($mess) and !empty($mess)) if(($newmess="$login>>$mess\r\n")!=$list[0])
{ array_unshift ($list, $newmess); if(isset($list[$chat_post])) unset ($list[$chat_post]);
$fp=fopen($file,'w'); fwrite($fp, implode('',$list)); fclose($fp); }
$out='<input name="mess"><input type=submit value="Ответ"><br>'.nl2br(implode('',$list));
}
echo'<meta http-equiv="refresh" content="'.$chat.';URL='.$home.'/chat/index.php?login='.$login.'">
<a href="'.$home.'/chat/index.php?login='.$login.'">Обновить</a><br/>';
?>
</head><body>
<form name=form method=post action='index.php<?=(isset($login)?'?login='.$login:'')?>'>
<?=$out?>
</form>
<?
include '../include/foot.php';
?>