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 previous question of mine suggests).
I'd like to integrate it into the php that authenticates logins.
Is something like this a good idea
<?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 ?<?=time()?> query sting
if ( !isset$($_COOKIE['login_cookie'] )
{
//render login-form page
}
else
{
//redirect to the content page
}
The javascript cache/cookie check from this page (as follows)
var uniqueKey = '<%= SomeUniqueValueGenerator() %>';
var currentCookie = getCookie(uniqueKey);
var isCached = currentCookie !== null;
setCookie(uniqueKey); //cookies should be set to expire
//in some reasonable timeframe
I suppose I should do something like this,
//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().";'
}
but I am a little unsure exactly how to bring it all together.
Thanks