Jump to content

Recommended Posts

When someone is linked to a page that is availible only to those who are logged in, i redirect them to login.php, letting them either login, or register. so after that, it brings them to there main page on the site, so the link they originally came for, isnt even seen unless they link again, or go back a few times...

 

So, i was on Facebook the other day, and noticed that they do exactly what im looking for, so after there login, they are directed straight to what they were originally linked to...

 

I'm hoping someone gets what i mean, any clues on how i can set up the redirection?

Link to comment
https://forums.phpfreaks.com/topic/184950-redirect-after-sucsessful-login/
Share on other sites

one common method is to set a cookie or a session value with the page that they were on. for example when the user visits protectedpage.php and doesnt have rights you would set a cookie with that pages location. then when the user logged in on login.php you would check if that cookie was set and if so you would redirect them to the url that is in the cookie and if not you would redirect them to there normal page. same idea for sessions but typically session arent set until a user is logged in thats why i went with the cookie example.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.