Hello sir,
In my project i need to display online user in sandbox.For it i have made a login_status field in users table.When any user login to website it becomes true and if a user logout then it's value changed to false.but if a user leaves website without logout then i am unable to show him offline or changes login status to false.Is there any way to find out which user is searching website and whichone left the website without logout.

You can use Javascript to capture the onlcose event of the window and request that a user logs out properly, look at this page for instructions: http://royaltutorials.com/javascript-popup-onclose/
Also, you can have another field in your DB that records the time of the last action of the logged in user, and then when another user accesses your page, and you run the routine to show which users are logged in, it can drop any users that have been inactive for x minutes from the list of logged in users in the DB.