Sorry if I didn’t show you the code because I have no idea how to implement it. I just want to know that for instance in YouTube, when you want to make comment on the video, you have to login in, so how to redirect you to the previous video page that you want to make comment. I suppose I need to store the url of the previous page into a session, but if the user didn’t login, can I still keep track of the url, Sorry for my confusion. I want to do it in php, can anyone help me with it, thanks in advance:)
Share
you can simply use something like this too..!!
when the user need to redirected back to a page., lets suppose he wanted to comment on post.php page but when he tries commenting it will redirect to login if not already logged in., so, during yu redirect him to login page, send a get parameter to login page like
http://example.in/login.php?redirect_url=http://example.in/post.php
now handle this get parameter in the login.php page and when the credentials are authenticated you can just redirect him back to the url which is sent through the get parameter..!
your login.php can be something like this
Hope this helps