http://www.swgfreak.com/k/chat.swf
My chat there takes a users message, and sends it to a text file. Problem is it adds slashes with apostrophes, it doubles forward slashes. Here is my php code im using to send and load the txt from flash.
to: This is the php file that writes the chat to the txt
<?
$fp = fopen("chat.as", "a"); //Open the chat file. "a" means: Open for writing only.
if ($message_bottom<>"") { //Looks the empty line at the bottom of the chat.txt
$message_bottom=trim($message_bottom); //Clear white spaces
//Sets the whitespace found at the bottom to the new message entered
$message_bottom=$message_bottom." (".date("jS h:i A").")\n"; //Adds the date to the end of each message sent.
fwrite($fp, utf8_encode("$message_bottom")); } //Writes the message to the chat.txt
fclose($fp); //Closes the chat.txt
?>
From: This is the php that displays the chat
<?php
$arrText=file("chat.as"); //Puts everything in chat.txt into the $arrText array.
$chat="";
// $i gets
for ($i=count($arrText); $i>count($arrText)-50; $i--) { //for ($i=0; $i<count($arrText); $i++) to print bottom to top
$arrText[$i]=trim($arrText[$i]); // Strips the white spaces from the beginning and end of each line.
$chat_from=$chat_from.$arrText[$i]."\n"; //Starts adding the lines in the chat.txt to $chat_from
}
echo "chat_from=".$chat_from; //Outputs all the text found in chat.txt
?>
Someone recommended I use the utf8_encode in my php but that never changed anything. Any other suggestions ?