Matt Matijevich wrote:
<snip>
Is there a way to extend the php session timeout for particular pages?
Alternatively, is there a way, other than using cookies, to store user
data
from page-to-page?
</snip>

I think you can use ini_set() to change session.gc_maxlifetime, that
will change your session timeout.

You could pass data around in hidden fields but that would be a pain.

Well, the manual says you can set that parameter using ini_set(), but I don't see how it would work. It only comes into play when garbage collection is triggered, which could be by another thread that doesn't have this setting. Just doesn't seem like it would work.


As for the original question, a simple method is to save $_POST or $_GET ($_SESSION['saved_request'] = $_POST;) and the page that was requested into the session. After a successful login, you see if a "requested page" exists and redirect to that page instead of the normal page.

Then, in your pages that handle forms or URL variables, have them look in $_SESSION['saved_request'] for values and retrieve them using $_POST = $_SESSION['saved_request']; before they process the values. No need for a bunch of hidden form fields and all that hoopla! :)

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to