Php - flash chat system

[font=verdana, arial, helvetica][size=2]I have attempted this several times. And once I even got it working… sort of. But, I think the basic problem isn’t the coding, it is the logic. Here is a brief sinapsis of the logic I used:
Step one: When a user logs in, write to .txt document “print=so and so logged in & time=04:20:48”
Step two: Wait 2 seconds query .txt document, get all info after when so and so logged in, and display in text box.
Step three: When a user posts a message, write “print=so and so said: such and such & time=04:23:50”.

Now of course those times ar just made up. How would you recomend I should re-think my logic to be faster, and more user friendly.

Thank you in advance.
-Mister B.[/size][/font]