Ok, i have a php chat i am coding 100% from scratch, I am ALMOST done, but i need to get this one LAST code working... the chat window (were the messages are displayed) is an iframe above a text box and submit button... Following? OK, well I have it post new messages to an HTML file in this format:
Code: Select all
<b><font color=red>$username: </b></font><font>$message</font><br>
The PHP will check the filesize of the messages.html file....
Then it will loop a command that compares the filesize to what the filesize was when it first checked.... If it notices a change in filesize (because a message was saved to the file), it will grab the last line of the HTML file, and put it to a variable, then print "$that_variable'; and then loop to the begining of the file and start all over.... therfore, as soon as a message is sent, it should post imidiatly..... This is the code I came up with, and i know it is wrong, I just wrote it to give an idea of what i need to do...
Code: Select all
<?
Set loop point
$room = $_GET['room'];
$filesize1 = filesize("rooms/chat_$room.html");
$filesize2 = filesize("rooms/chat_$room.html");
While ($filesize1 == $filesize2):
$filesize2 = filesize("rooms/chat_$room.html");
Endwhile;
fopen rooms/chat_$room.html..
get last line of chat_$room.html, and set to variable $message
echo '$message';
Goto loop point
?>?>[/php_man]