Codice PHP:
$nickname = str_replace ("\n"," ", $_POST[nickname]);
$nickname = str_replace ("<", " ", $_POST[nickname]);
$nickname = str_replace (">", " ", $_POST[nickname]);
$nickname = stripslashes ($_POST[nickname]);
?>
<?
$chat_file = "chat.txt";
$lines = file($chat_file);
$count = count($lines);
//echo "&count=$count";
?>
&output=
<?
$chat_file = "chat.txt";
$chat_lenght = 80;
$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 ("\\","", $_POST[message]);
//
//IF THE FORGOT TO ADD HTTP:THIS WILL DO IT FOR THEM
$webStart = Array ('WWW', 'www');
$changeWebstart = 'http://www';
$msg = str_replace ($webStart, $changeWebstart, $msg);
//this will take away the double http part
$webDouble = Array ('http://http://www');
$changeWebSingle = 'http://www';
$msg = str_replace ($webDouble, $changeWebSingle, $msg);
// BOLD, ITALICS, UNDERLINE AND PRE PARSER
$searchFor = Array ('[b]', '[/b]', '[pre]', '[/pre]', '[i]', '[/i]', '[u]', '[/u]','&');
$replaceWith = Array ('<b>', '</b>', '<pre>', '</pre>', '<i>', '</i>', '<u>', '</u>','');
$msg = str_replace ($searchFor, $replaceWith, $msg);
// Swear Word Filtering Section
$badwords = Array ("fuck", "shit", *********, "fucker", "fucking", "bitch", "cunt", "pussy", "dick", "stronzo", "nigger", "whore", "stronza", "*****", "vaffanculo");
$changeto = '<font color="#ff3300">******</font>';
$msg = str_replace ($badwords, $changeto, $msg);
Edit: