Expire a Webpage

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
student
Forum Newbie
Posts: 5
Joined: Wed Nov 11, 2009 3:01 am

Expire a Webpage

Post by student »

Hi guys!

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

Thanks!
fubariser
Forum Newbie
Posts: 5
Joined: Thu Nov 19, 2009 2:33 am

Re: Expire a Webpage

Post by fubariser »

Did you mean to expire a session?
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Expire a Webpage

Post 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?
student
Forum Newbie
Posts: 5
Joined: Wed Nov 11, 2009 3:01 am

Re: Expire a Webpage

Post 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.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Expire a Webpage

Post 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.
student
Forum Newbie
Posts: 5
Joined: Wed Nov 11, 2009 3:01 am

Re: Expire a Webpage

Post 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?
Marinusjvv
Forum Commoner
Posts: 29
Joined: Wed Dec 02, 2009 5:59 am

Re: Expire a Webpage

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