login - Go back to last webpage after logging in -


i need figuring out how allow users login go page on before being sent login page. here quote boss:

sometimes forget sign in , go page, click , notice joining or signing in. fine, there way, once sign in open page trying open prior signing in, instead of having go through navigation again?

i'm using php project.

whatever mechanism forwards user sign-in page should include original page's url parameter. like:

header('location: http://example.com/login.php?redirectto=' + urlencode($_server['request_uri'])); 

then login.php page can redirect page after user authenticates:

header('location: ' . $_get['redirectto']); 

you may want put in checking on redirectto value in login.php make sure nobody's trying malicious, suppose. though can't think of malicious do. (though would want include default if no url provided.)

but general idea authentication mechanism provides login page redirect url when detects user needs login.


Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -