|
Hello, there.
I'm developing a chat based on PHP, that will run on Flash. In the message screen, I would like to set different colors to nickname and message. Below follows the script:
<?
header("Expires: ".gmdate("D, d M Y H:i:s")."GMT");
?>
<?
$nickname = str_replace ("\n"," ", $nickname);
$nickname = str_replace ("<", " ", $nickname);
$nickname = str_replace (">", " ", $nickname);
$nickname = stripslashes ($nickname);
?>
&output=
<?
$chat_file = "chat.txt";
$chat_lenght = 40;
$max_single_msg_lenght = 100000;
$max_file_size = $chat_lenght * $max_single_msg_lenght;
$file_size= filesize($chat_file);
if ($file_size > $max_file_size) {
$lines = file($chat_file);
$a = count($lines);
$u = $a - $chat_lenght;
for($i = $a; $i >= $u ;$i--){
$msg_old = $lines[$i] . $msg_old;
}
$deleted = unlink($chat_file);
$fp = fopen($chat_file, "a+");
$fw = fwrite($fp, $msg_old);
fclose($fp);
}
$msg = str_replace ("\n"," ", $message);
$msg = stripslashes ($msg);
if ($msg != ""){
$fp = fopen($chat_file, "a+");
$fw = fwrite($fp, "$nickname: $msg\n");
fclose($fp);}
$lines = file($chat_file);
$a = count($lines);
$u = $a - $chat_lenght;
for($i = $a; $i >= $u ;$i--){
echo $lines[$i];
}
?>
Is it possible to attribute a color to:
$fw = fwrite($fp, "$nickname: $msg\n");
so the nickname gets grey, while the msg gets white?
On Flash, the entire text field (that loads chat.txt) has a specific color (white). Is it possible to manage different colors inside the PHP script, so it ignores the Flash statements and stablishes different colors for different tags?
I hope I´ve been clear.
Thanks a lot for your attention.
Best regards,
F. Almeida
|