Page 1 of 1

Expire a Webpage

Posted: Thu Nov 19, 2009 3:11 am
by student
Hi guys!

How can I expire a webpage whenever the user hit back, forward & refresh (in php)?

Thanks!

Re: Expire a Webpage

Posted: Thu Nov 19, 2009 3:51 am
by fubariser
Did you mean to expire a session?

Re: Expire a Webpage

Posted: Thu Nov 19, 2009 3:52 am
by jackpf
You can't really do this, since the page is generally loaded from cache.

You can send a no cache header and then check the referrer...but why? What's the point?

Re: Expire a Webpage

Posted: Fri Nov 20, 2009 12:46 am
by student
I'm doing a login page
and I don't want the user to go back to the login page
after they have already logged in.

Re: Expire a Webpage

Posted: Fri Nov 20, 2009 1:11 am
by jackpf
Then yeah, I suppose you can tell the browser not to cache the page, and if the user is logged in already, redirect or something.

Re: Expire a Webpage

Posted: Thu Dec 03, 2009 2:15 am
by student
by setting the php.ini file i had

session.cache_limiter = nocache

However it still seems to be caching the inputs i entered. Any idea how to solve it?

Re: Expire a Webpage

Posted: Thu Dec 03, 2009 2:31 am
by Marinusjvv
How about creating a session variable that you set to 'true' when logged in. Eg:

Code: Select all

if($password == $_REQUEST["password"])
{
$_SESSION["logged_in"] = true;
}
then, on the top of your login page:

Code: Select all

if($_SESSION["logged_in"] == true)
{
 // redirect to watever page
}