Girovagando su internet ho trovato una chat semplice in php. Funziona tutto bene, però siccome non include faccine ho cercato di farlo io, ma non ci sono riuscito. I file sono...

chat.php

<?php
@session_start();
if(!isset($_SESSION['user'])){
@header('Location:login.php');
}else{
$user= stripslashes($_SESSION['user']);
?>
<html>
<head>
<title>Una chat in PHP ed AJAX</title>
<style type="text/css">
#CHAT
{
background: #F2F4DE;
width: 400px;
height: 250px;
overflow: Auto;
}
#MSG
{
position: Absolute;
visibility: Hidden;
}
</style>
<script type="text/javascript" src="chat.js"></script>
</head>
<body>
<h1>Una chat in PHP ed AJAX</h1>


Ciao <?php echo $user; ?></p>
<div id="CHAT"></div>
<form name="chat" method="post"
action="messaggio.php" target="MSG">
<input type="text" name="messaggio" size="50" maxlength="200">
<input type="submit" value="CHAT">
</form>
<iframe src="messaggio.php" name="MSG" id="MSG"></iframe>
</body>
</html>
<?
}
?>

messaggio.php

<?php
@session_start();
if(!isset($_SESSION['user'])){
@header('Location:login.php');
}else{
if(isset($_POST['messaggio'])){
include 'config.php';
$user = $_SESSION['user'];
$mex_chat = addslashes($_POST['messaggio']);
$query = "INSERT INTO $tb (user_chat, mex_chat)
VALUES ('$user','$mex_chat')";
@mysql_query($query)or die (mysql_error());
@mysql_close();
@header('Location:chat.php');
}
}
?>

ajax.php

<?php
@include 'config.php';
$sql = "SELECT user_chat, mex_chat FROM
$tb ORDER BY id_chat DESC LIMIT 0,10";
$sql_res = @mysql_query($sql)or die (mysql_error());
if(@mysql_num_rows($sql_res)>0)
{
while ($fetch = @mysql_fetch_array($sql_res))
{
$utente = stripslashes($fetch['user_chat']);
$mex_utente = stripslashes($fetch['mex_chat']);
echo ''. $utente .': '. $mex_utente.'
';
}
}else{
echo 'Non sono stati ancora inseriti dei messaggi.';
}
@mysql_close();
?>

a riguardo ho creato già la pagina faccine.php che sarà cosi credo??
$mex_utente = addslashes('','[img]smile/1.gif[/img]',$mex_utente);
$mex_utente = addslashes('','[img]smile/2.gif[/img]',$mex_utente);
Ecc..

Grazie a chi mi risponderà!