note 76398 added to function.session-cache-limiter

From: Date: Fri, 13 Jul 2007 08:19:51 +0000
Subject: note 76398 added to function.session-cache-limiter
Groups: php.notes 
Request: Send a blank email to php-notes+get-128433@lists.php.net to get a copy of this message
Here is some magic for you PHP session lovers out there; it seems that if you use 'nocache' as an argument for this function, PHP will send the following headers automatically for you: -------------- Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache -------------- Which pretty much render any cache ineffective because no proxy or browser that follows the HTTP 1.1 protocol will cache your request. In short, every page request, whether explicitly through a page reload or not, will go through your server. Not something good for those of us looking for a bit of security but also for some performance juice. The only way to override these headers, if you use the 'nocache' as an argument, is to use the header( ) function after you start your session but before you send any output: <?php // Above Headers Sent By PHP. session_cache_limiter( 'nocache' ); // Start Session. session_start( ); // Override Headers. header( 'Cache-Control: no-cache, must-revalidate, post-check=3600, pre-check=3600' ); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 217.54.224.163 ---- Manual Page -- http://www.php.net/manual/en/function.session-cache-limiter.php Edit -- https://master.php.net/note/edit/76398 Del: integrated -- https://master.php.net/note/delete/76398/integrated Del: useless -- https://master.php.net/note/delete/76398/useless Del: bad code -- https://master.php.net/note/delete/76398/bad+code Del: spam -- https://master.php.net/note/delete/76398/spam Del: non-english -- https://master.php.net/note/delete/76398/non-english Del: in docs -- https://master.php.net/note/delete/76398/in+docs Del: other reasons-- https://master.php.net/note/delete/76398 Reject -- https://master.php.net/note/reject/76398 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128433) next »