What would be nice, in further, is to bind your php scripts with a simple customisable mysql table where you will add registered chat users.
It would permit to prevent someone to take nickname of someone else who is registered in this table...
only a suggestion..
++
PaowZ