开发者_如何学CLets say the site has a user account system that uses sessions to login/verify etc.
So let say i send somebody the link domain.com/photos?id=3akK90 and they must be logged in to see it. So naturally the site will ask them the login but after login the home page will show, so how can i do it so that there is a referrer they should be able to login and go directly to that page.
I'm presuming you're redirecting to the login. Capture the URL they initially went to, store it in a session variable and after the login redirect them.
That's a very broad question, perhaps looking into $_SERVER['HTTP_HOST'] will help. When the user initially goes to the URL, the PHP will know the URL they came to. When the login is complete, the PHP can redirect to that URL with a Location header
on /photos
check for user login
if no user login
save complete url in session
forward to /login.php
on /login.php
when you catch the post
if the login is successfull
if that session variable exists and not null
forward to the complete url that was saved
精彩评论