Page 1 of 1

refresh page

Posted: Tue Nov 30, 2004 8:07 am
by gurjit
Hi all,

I need to make a session last until the browser is closed. The browser can be left open all day. So i thought the best way would be to refresh the page every 20 mins with a

Code: Select all

<meta http-equiv="refresh" content="0; url=home.php">
However i cant simply do this because i pass many variables on this page, which are either posted via a form or sent via a <href> link and i have many variables passed from popups back to this home.php page, so coding for each variable would be crazy.

The question is how can i display what variables are currently passed through the page whether they be <form> or <href> passed?

i tried

Code: Select all

$_SERVER&#1111;"REQUEST_URI"]
but this only displays the variables passed through a <href> link and not <form> variables. any other solutions.

thanks in advance

Posted: Tue Nov 30, 2004 8:19 am
by protokol
Try session_cache_limiter('private_no_expire');

[php_man]session_cache_limiter[/php_man]()
[php_man]session_cache_expire[/php_man]()

Posted: Tue Nov 30, 2004 8:27 am
by gurjit
I done this, so i assume that what will happen is that the session will last 8 hours?

If i open popups from home.php will these still keep the session open?



Code: Select all

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();


session_cache_expire(28800);

session_start();
$cache_expire = session_cache_expire();

Posted: Tue Nov 30, 2004 8:29 am
by protokol
Yeah, I'm pretty sure this is the general idea. If you do popups, make sure you call those session functions on those pages as well.

Posted: Tue Nov 30, 2004 8:46 am
by gurjit
The session does not destroy when you re-login.

I have used

Code: Select all

<?php
session_start();
session_destroy();

session_unset();
?>
seems to cache now. how can i make sure the entire cache resets when you click on the logout link?

Posted: Tue Nov 30, 2004 8:55 am
by protokol
I haven't done this type of caching, but this _might_ work

session_cache_expire(0);
session_destroy();

Posted: Tue Nov 30, 2004 8:59 am
by gurjit
tried that no luck

Posted: Tue Nov 30, 2004 9:05 am
by protokol
OK, I realized caching it is not a good idea.

Posted: Tue Nov 30, 2004 9:06 am
by gurjit
any other ideas?

Posted: Tue Nov 30, 2004 9:06 am
by protokol
Actually, I'm wrong. Try doing:

Code: Select all

<?php
session_cache_limiter('nocache');
session_cache_expire(0);
session_start();
session_destroy();
?>

Posted: Tue Nov 30, 2004 9:07 am
by protokol
Keep using the caching stuff, but use this to set the default back to non-caching sessions and then expire and destroy the cache and session. In concept this seems like it would work, but again I'm not 100%.

Posted: Tue Nov 30, 2004 10:30 am
by gurjit
i tried everything but once you set

session_cache_limiter('nocache');

you cant give a limiter time.

Once you set it to

session_cache_limiter('private');

you cant take the cache away until you give your browser a control+F5 refresh if you login as another user.