Forum Moderators: coopster

Message Too Old, No Replies

ob_start() and Going back to the previous page

         

Francis

1:32 am on Feb 4, 2004 (gmt 0)

10+ Year Member



1. How do I go back to the previous page using PHP?

For example, I have a log-in process which validates username and password of members, and also retricts access to certain pages. So if a member goes into a page without logging in, the member will be presented with a form to log in. How can I make my script go back to the previous page they were trying to access prior to logging in?

2. What would happen if I use ob_start and ob_end_flush() on every page that I have? Would it affect loading time? Or would loading time be the same except that it would cache everything first? Isn't that suppose to make it appear that the page loads fast?

ergophobe

6:27 pm on Feb 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




How can I make my script go back to the previous page they were trying to access prior to logging in?

I don't know whether this is the best solution, but... Presumably you have a session running if you have a login.

When the person gets forwarded to the login page, before forwarding, set a $_SESSION['referer'] variable. Use that to create a hidden field in the login form. That data will then be posted and when you process the login, you cna check the session var and, if it's set, use

header("Location:..");

to send them back where they came from

Don't know about buffering and load times...

Tom