integrate cached-page check into index file
<p>I'm trying to set a main page to reload with a query string so it doesn't come from a cached file. the page is index.php, but i'd like to, whenever the page loads, hava a unique string appended to it (like the answer in the comments by Rocket to <a href="http://stackoverflow.com/q/10823672/1252748">a previous question of mine</a> suggests). </p>

<p>I'd like to integrate it into the php that authenticates logins.</p>

<p>Is something like this a good idea</p>

<pre><code>&lt;?php

require_once('login-config.php');

//use javascript cookie to detect if the page is coming from hash
//and if so, redirect to a new url with a ?&lt;?=time()?&gt; query sting

if ( !isset$($_COOKIE['login_cookie'] ) 
{

//render login-form page

} 
else 
{

//redirect to the content page

}
</code></pre>

<p>The javascript cache/cookie check from <a href="http://stackoverflow.com/a/4433812/1252748">this page</a> (as follows)</p>

<pre><code>var uniqueKey = '&lt;%= SomeUniqueValueGenerator() %&gt;';
var currentCookie = getCookie(uniqueKey);
var isCached = currentCookie !== null;
setCookie(uniqueKey); //cookies should be set to expire 
                      //in some reasonable timeframe
</code></pre>

<p>I suppose I should do something like this, </p>

<pre><code>//best guess is that I update this uniqueKey every time I update the page
//and want it not to load from cache
var uniqueKey = 'v1.1';
var currentCookie = getCookie(uniqueKey);
var isCached = currentCookie !== null;

if (!isCashed){      
    setCookie(uniqueKey);  
    window.location'?".time().";'
} else {
    window.location'?".time().";'
}
</code></pre>

<p>but I am a little unsure exactly how to bring it all together.</p>

<p>Thanks</p>
