Sera...
Ho una chat flash php...
l'ho montata sul server, ma la main non mi finziona...
funziona tutto tranne la scrittura dei messaggi nel file txt che dovrebbe contenerli e mandarli in main!
Qualcuno sa consigliarmi oppure provare a montarla?
Printable View
Sera...
Ho una chat flash php...
l'ho montata sul server, ma la main non mi finziona...
funziona tutto tranne la scrittura dei messaggi nel file txt che dovrebbe contenerli e mandarli in main!
Qualcuno sa consigliarmi oppure provare a montarla?
Potresti iniziare postando il codice della chat o un link di riferimento,altrimenti cm facciamo ad aiutarti? :wink:
Ecco il codice del file chat.php :
Edit: Quando scrivi del codice mettilo all'interno dei tag preposti.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);
Ehm...censura le badwords... :roll: :roll: :lol:
Inoltre metti il codice negli appositi tags altrimenti vengono fuori posts chilometrici :wink:
Tornando al codice,sostituisci con:
La funzione di scrittura nel file di testo non veniva eseguita...Codice PHP:$fp = fopen($chat_file, "a+");
@fwrite($fp, $msg_old);
fclose($fp);
le stringhe per la scrittura sono presenti...erano scritte a fine codice e non le avevo postate...
il problema e' altrove!!! :(