Problem with cookies and multisite
-
The rated check does not work correctly when deployed to a directory based multisite install.
FYI My multisite install is deployed to /charlie/ and the subsites live at /charlie/****/
For example the site with path /charlie/test-josh/
Is setting the cookie as so
Set-Cookie rated_6138=1; expires=Sat, 15-Nov-2014 02:16:34 GMT; path=/charlie/
The problem with this is that it will act as if the voter has already voted for the post with an id of 6138 on all subsites that are deployed under /charlie/ .
It appears that as implemented the cookie + IP option does not negate with problem either as the cookie is checked first and then the IP is checked only if the cookie check returns false.
To resolve the issue I suggest setting the cookie path to the path with is returned by
site_url();
The following is the problem code from 1.65. The COOKIEPATH below returns the root path of the multisite install.
$rate_cookie = setcookie("rated_".$post_id, $ratings_value[$rate-1], time() + 30000000, COOKIEPATH);
- The topic ‘Problem with cookies and multisite’ is closed to new replies.