That being said, I have made a change to my "experiment".
Originally, I used code from http://cookiecuttr.com/ which uses a Jquery and Javascript solution to the issue. The problem I had with it, was that I still would have session ID's stored on the user and taking that out causes serious problems for the site.
So my next attempt was to remove all of that... and replace it with a simple PHP set of commands.
The first gets placed in the control php script (index.php) which is used by the site to direct the user to whatever page they have asked for. In it, it has a simple cookie check and if it doesn't find it it sends the user to a stripped down cookies.php script.
Index.php Redirect
The code in the index.php file is:
Code: Select all
if(!isset($_COOKIE['cc_cookie_accept'])) {
header("Location: /cookies.php");
exit;
}Cookies.php script
This script uses the basic format of the website, but is not flowing through the normal processing scripts. At the top of the script it checks to see if the cookie is set. If it is, it redirects the user to the real site.
Code: Select all
if(isset($_COOKIE['cc_cookie_accept'])) {
header("Location: /");
exit;
}Code: Select all
if(isset($_GET['cookie'])) {
if($_GET['cookie'] == "ACCEPTED") {
setcookie("cc_cookie_accept","cc_cookie_accept",time()+60*60*24*364);
}
header("Location: /cookies.php");
exit;
}Code: Select all
<center><form >
Accept Cookies From this Site: <input type="radio" name="cookie" value="ACCEPTED" checked="checked" /> <br/>
Decline Cookies: <input type="radio" name="cookie" value="decline"/><br/> <br/>
<input type="submit" name"submit" value="Set Your Preference"/>
</form></center>If the user doesn't accept cookies, they never get to the real site. No cookies, no site.
Missing from this at the moment is a check for robots which you really wouldn't want trapped by this. Need to come up with a simple common method to identify them. Looking into that now.
You can see this in action by going to http://cumulus.tnetweather.com
of course, if you have already accepted the cc_cookie_accept cookie, it won't do anything. So you would need to delete that cookie to see it work.
Note that this removes ALL of the jquery stuff that was put into the site originally. I just removed that now.