Jump to content

Remember User Login URL


southasia

Recommended Posts

How to use cookie and session in following manner?

Let say we login to the phpfreaks and left it open about thirty minutes, the next time we click on any menu link if the cookie is expire it will redirect to the login page for authentication again. After login it will redirect back to the page that user left the last time. How can I achieve that? :confused:

 

 

Link to comment
https://forums.phpfreaks.com/topic/189114-remember-user-login-url/
Share on other sites

Here's what I would do... I'm sure there are way better ways to do it but I think it'll get the job done.

 

1. Create a field in the database and name it something like lastlink

 

2. Include a file on every page. All that file does is update the current url to the user's lastlink field. Everytime a user clicks to go somewhere on the website it'll reactivate that file and therefore it'll update the lastlink field.

 

3. Once cookie dies and user logs in, just make it redirect to the url in lastlink.

 

That's just the gist of it. I'm sure you want to add more things to it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.