pokemon-showdown-client/js/clean-cookies.php
Guangcong Luo 7c18649859 Workaround for large cookies
The FCCDCF cookie frequently goes oversize, and has recently
been causing people to be unable to access PS because their total
cookie size is going over 8KB, above Apache's default maximum.

https://business.safety.google/adscookies/

It looks like this cookie is set by Google and, according to the
internet, sometimes gets filled with junk? I don't know of an
easy way to fix this, but I'm hoping this does it.
2023-11-10 00:59:11 +00:00

22 lines
647 B
PHP

<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
$cleaned = false;
foreach ($_COOKIE as $name => $value) {
if (strlen($value) > 3000) {
setcookie($name, '', time()-1000, '/', 'play.pokemonshowdown.com');
setcookie($name, '', time()-1000, '/', '.play.pokemonshowdown.com');
setcookie($name, '', time()-1000, '/', 'pokemonshowdown.com');
setcookie($name, '', time()-1000, '/', '.pokemonshowdown.com');
$cleaned = true;
}
}
if ($cleaned) {
echo 'alert("You had a cookie which was too big to handle and had to be deleted. If you had cookie settings, they may not be right.")';
}