No offense but a quick search on google for "php user online" gives you everything you want There are dozens of examples for those scripts with and without mysql support. I suggest you try one of the tutorials you find there