how to signout/logout user from my site when user directally close browser (not click to signout/logout button). plz tell me.........
Use just sessions for your logins. Sessions are destroyed automatically when a user closes all browser windows.
If you're using cookies though, look into AJAX posting. You could maybe do: <script type="text/javascript"> window.onbeforeunload = function() { YOUR AJAX CALL HERE - CALL A PHP FILE WHICH UNSETS THE COOKIES } </script> Code (markup): I also believe you can handle cookies directly with javascript but I have no idea bout that, I stick to PHP mostly.
You don't have to. When you create the cookie just set it to expire when the browser closes. When a user goes to sign in VERIFY the login then erase any existing database entries associated with that session then create a new one and set a new cookie.
The site never knows that the user closed the browser window. But the session will time out all by itself. Do it the way NetStar says if you don't want to depend on session timeout.