Shoutbox med .txt database
Hej..<?
$chat_file_ok = "../include/shout.txt";
$chat_lenght = 500;
$max_single_msg_lenght = 100000;
$max_file_size = $chat_lenght * $max_single_msg_lenght;
$file_size = filesize($chat_file_ok);
if ($file_size > $max_file_size) {
$lines = file($chat_file_ok);
$a = count($lines);
$u = $a - $chat_lenght;
for($i = $a; $i >= $u ;$i--){
$msg_old = $lines[$i] . $msg_old;
}
}
$msg = str_replace ("\n"," ", $message);
$msg = str_replace ("\n"," ", $message);
$msg = str_replace ("<", " ", $msg);
$msg = str_replace (">", " ", $msg);
$msg = stripslashes ($msg);
if ($msg != "" && $navn != "" && $navn != "Dit navn!" && $msg != "Shout!"){
$fp = fopen($chat_file_ok, "a+");
$fw = fwrite($fp, "<br><b>$navn</b><br>$msg
");
fclose($fp);
}
$lines = file($chat_file_ok);
$a = count($lines);
$u = $a - $chat_lenght;
for($i = $a; $i >= $u ;$i--){
echo $lines[$i] . "";
}
?>
Kan det ikke laves lidt nemmere.. den skal bare smide: ""<br><b>$navn</b><br>$msg" ind i filen include/shout.txt - Se evt. http://80.63.96.228/nyt/ ude til højre.. Det er min nyværende.. Den virker ikke optimalt.. Forstår i ? Eller spørg.. :)
