Hi All,

I want to know how to write a php script that run in background in browser when anyone login.

Keep in mind that browsers don't execute PHP - only your server does that.

You might be able to do this by writing some JavaScript that uses AJAX to periodically execute your PHP script. You'll need to limit the frequency of the AJAX calls or you risk bogging down both the user's browser and your server.

It depends on what type of script you want to run in the background. You need to give us more information. Speculation is not a good thing.