I currently have a login script that sets a cookie to expire after 8 hours. After the cookie has expired I want to redirect the user back to the login page? How would I achieve this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the login is on a different page, you could put this at the very top (before any output to the client):
But you will want to add some extra logic here to check for cookie values or whatever depending on how valuable the data is on the site. In the above example, someone could fake the cookie extremely easily.
or if you prefer sessions, just replace COOKIE with SESSION: