I am new in development and am developing an attendance system in core php.... Basically I want to know how to store the attendance timeout in database at the time when somebody closes the browser he should logout as well.
You can do this using window.onBeforeUnload
event.
Also, as suggested in comments, sendBeacon
experimental function also could be used.