At any forum , you can see if a specific member is online or offline, or generally , how can I detect online visitors accurately who are visiting my website at the moment ...

Thanks in advance

That is typically done by logging the time when a given user (or a guest, if you want that) was last seen.
Once a user hasn't been seen for some predetermined amount of time, he is considered off line.

This is really the only reliable method, given the stateless nature of the web.

Have a look at and play about with that code.
Sam Rudge

This was actually the script I was going to suggest. You could implement it with your current system and possibly identify the IP addresses by the IP addresses your users logged in with. Just a thought.

I think you can done this idea by session (for members)

like if session user is available so the user is here

Member Avatar

IP address is unreliable.
DB sessions could be a way to go, although last_impression timestamp for logged on users can be used as a cut-down version. You need a clean up with these though (php script or MySQL trigger), unless you run a cron job every 20 minutes or so.