End session when you are not in webpages
===

I have a website which established by php. I have 4 access level. I want when ever that I am not in my website pages, session being destroyed. for example , imagine that a user goes to index.php and log in but he/she push back bottom until goes to another website pages, n this case session must his be destroyed.I don't have any idea in this case. so, I really appreciate if send me a complete code
regards