I'm working on building a forum in PHP and am trying to include a feature that would log a user out after a certain amount of time. It would also direct them back to the login page after the elapsed time. I've built the forum using separate php pages for the connection, login, logout, index, header, footer and other pages. I include the connection and header php files at the top of every page. Where would I place a script to have it communicate throughout the forum and effectively timeout a user?

Member Avatar for LastMitch

I'm working on building a forum in PHP

What framework are you using? The question you ask is very general. You need to be specific with the question. If you are using a framework, then it will be easier to be answer. But if you are going to ask for scripts and not knowing how to organized it, then things will get lost.

This is a link to the forum I'm working on Click Here
I looked over the thread you posted @pixelsoul and added the script posted there into the header of my website. It appears to be working properly now. After 30 minutes (1800 seconds) the user is redirected to the login page.

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.