Return to previous page after login

Oi!

I have long wanted to use the returntosamepageafterlogin function on my site. But what is the best way?

I was thinking about saving the URL in the session, and when he / she logs in, I will check if returnto-session, if it is installed, if so, I will be redirected to this page

Is it safe / good?

+3
source share
2 answers

This is usually done by putting the URL of the previous page in the query string of the login page.

EDIT . Make sure the URL is a relative path and encodes it correctly.

+6
source

( , , ), (, "checkLogin()" ), , / cookie/ ( ) .
, , .

() , , ( , ). , .

, .

+2

Source: https://habr.com/ru/post/1754150/


All Articles