refresh page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

refresh page

Post 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
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

Try session_cache_limiter('private_no_expire');

[php_man]session_cache_limiter[/php_man]()
[php_man]session_cache_expire[/php_man]()
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post 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();
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post 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.
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post 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?
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

I haven't done this type of caching, but this _might_ work

session_cache_expire(0);
session_destroy();
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post by gurjit »

tried that no luck
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

OK, I realized caching it is not a good idea.
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post by gurjit »

any other ideas?
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post by protokol »

Actually, I'm wrong. Try doing:

Code: Select all

<?php
session_cache_limiter('nocache');
session_cache_expire(0);
session_start();
session_destroy();
?>
User avatar
protokol
Forum Contributor
Posts: 353
Joined: Fri Jun 21, 2002 7:00 pm
Location: Cleveland, OH
Contact:

Post 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%.
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post 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.
Post Reply