how to set user status offline when he/she leaves my website

233 Views Asked by At

I am working on a website in php. how do we set user status to offline in databse when he leaves website by closing browser without click on logout button.

1

There are 1 best solutions below

0
Soader03 On
$(window).bind('beforeunload', function(){
  // Do your AJAX call here to set it to offline
});