la idea era poner un div del contenido dentro de otro div para poder perzonalizarlo un poco dejo el script aqui aver si alguien me ayuda y sino para quien le valla bien este script
Código :
<html>
<head> <LINK media=all href="estilo.css" type=text/css rel=stylesheet> </head>
<?php
$chat_file = // formato tipo: chat-10-06-1987.txt
'chat-'.date('d-m-Y').'.txt';
if (!is_file($chat_file))
{
// creamos el archivo?
touch($chat_file);
}
// ahora, a leer los mensajes...
$mensajes = file($chat_file);
if (isset($_POST['texto']) &&
isset($_POST['nick'])) // obligatorios!
{
$autor = $_POST['nick'];
// creamos una cookie para el nick del autor...
//setcookie('nick', $autor, time() + 84000);
$autor=drako;
$mensaje = $_POST['texto'];
$mensaje = strip_tags($mensaje);
$mensaje = htmlentities($mensaje);
$mensajes[] = "$autor <b>dijo:</b> $mensaje\n"; // agregamos
// reescribimos el archivo...
$tmp = fopen($chat_file, 'w+');
fwrite($tmp, join('', $mensajes));
fclose($tmp);
// regresamos!!!!
}
?>
<!--- aqui va el HTML -->
<div id="mensajes"><?php
foreach ($mensajes as $linea)
{
echo '<span class="mensaje" style="display: block">'.$linea.'</span>';
}
// restauramos la cookie del autor???
$autor = isset($_COOKIE['nick'])? $_COOKIE['nick']: '';
?></div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<div>
<input type="text" size="13" name="nick" value="<?php echo $autor; ?>"/>
<input type="text" size="52" name="texto"/>
<input type="submit" value="Enviar"/>
</div>
</form>gracias
