Page 1 of 1

Page Refresh Retain Location

Posted: Sun Feb 19, 2006 4:29 pm
by zeveck
Two quick questions that sorta fall under the subject:

1. How do you make it so that when a user tries to go to a page and isn't logged in they get prompted to login and then get directed to the page they'd previously requested? Right now I redirect them to the login page, but upon login they go to a specific location within the system instead of the page they'd been attempting to access. Of course, they could just paste the URL at that point, but is there a good method to automate this?

2. How do you make it so that when a user refreshes the page it remains where they were on the page rather than resetting to the top? Is there any easy way to do this?

Posted: Sun Feb 19, 2006 4:37 pm
by feyd
1. Store a referring page in the session variables before redirection?
2. This is controlled by the browser. Although there are a few Javascript tricks, it's not really worth it. Ajax may be of help here, but again, requires Javascript.

Posted: Sun Feb 19, 2006 4:46 pm
by zeveck
Thanx so much. I have to say you guys are awesome. PHP is quickly becoming my favorite programming language due to the quality of the documentation and user community.

Posted: Sun Feb 19, 2006 5:26 pm
by jwalsh
It's amazing what kind of documentation and community is created with the source code is left open :)

Posted: Sun Feb 19, 2006 5:58 pm
by MinDFreeZ
whoa, that'd be cool... "dynamic anchors".. there probably is a javascript way for that... but probably not worth the mess :P

Posted: Sun Feb 19, 2006 6:01 pm
by John Cartwright
MinDFreeZ wrote:whoa, that'd be cool... "dynamic anchors".. there probably is a javascript way for that... but probably not worth the mess :P
wha?

Posted: Sun Feb 19, 2006 8:23 pm
by MinDFreeZ
Jcart wrote:
MinDFreeZ wrote:whoa, that'd be cool... "dynamic anchors".. there probably is a javascript way for that... but probably not worth the mess :P
wha?
lol ..... he wants to keep it on the place on the page..... also known as an anchor.. but he doesnt want them to have to click anything or do anything at all... so I called it dynamic anchor... I made it up :D