I'm new to php, but not to programming, and i'm using very basics of sessions to manage a user being logged into my site. When testing it, everything works until I move away from my site. I would like the session to be destroyed if you navigate away, is there an easy way of doing this without using javascript (i'm trying to make my site javascript-less for those who chose not to have scripts enabled)?

Recommended Answers

All 2 Replies

There is no way to detect a user leaving your site without javascript. You can't do it serverside since in they leave they won't be interacting with your server :)

You can do session timeouts, where you log them out if they haven't requested another page from your server after X minutes, but that's standard procedure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.