faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

60 of 78 people (77%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

How do you make a page expire after it has been idle for a period of time?

Nov 27th, 2008 05:03
healthy man, dman, Brian Broadhead, Jonathan Sharp, John Chen, http://www.ttnr.org


Since the HTTP protocol is stateless meaning once the user has all the 
requested data from the server the connection stops, it's not possible 
to have PHP expire a page after it has been idle on an end users 
computer. 
It can be accomplished with JavaScript or a meta refresh tag...
just do a <meta http-equiv="Refresh" 
content="3600;URL=expiredNotice.php">
the 3600 is the number of seconds to expire the page and 
expiredNotice.php is the page the user will be sent to.
JS
_____________
If you mean a page on your server, PHP can find the date of the 
file/page...  put your date checking code at the top of the file...
UNLINK filename; (if old) 
send some excuses to client;
EXIT; to stop execution.
If you want to auto.check all your files, Make a private page for 
yourself to check all/some pages...
Better still... get the private page to send you the dates in 
cronological order instead... it might be safer!!!!!
Brian
http://www.healthdothealth.com
http://www.healthxhealth.com
http://www.mesotheliomainmesothelioma.com
http://www.healthfirewall.com
http://www.flathealth.com
http://www.healthbodyguard.com