fix cookie removal to use proper host

This commit is contained in:
Garvin Hicking 2008-07-14 08:02:28 +00:00
parent 68b684c1bb
commit bcc47f6f3a
2 changed files with 10 additions and 1 deletions

View File

@ -3,6 +3,9 @@
Version 1.4 ()
------------------------------------------------------------------------
* Make cookie deletion routine use the same host like cookie
insertion, thanks to JPhilip
* Added optional token insertion for comment notification
(moderation) e-mails, which you can click without the need
for authentication. This is a convenience feature, note that

View File

@ -620,7 +620,7 @@ function serendipity_setCookie($name, $value, $securebyprot = true) {
// If HTTP-Hosts like "localhost" are used, current browsers reject cookies.
// In this case, we disregard the HTTP host to be able to set that cookie.
if (substr_count($host, '.') < 2) {
if (substr_count($host, '.') < 1) {
$host = '';
}
@ -646,6 +646,12 @@ function serendipity_deleteCookie($name) {
$host = substr($host, 0, $pos);
}
// If HTTP-Hosts like "localhost" are used, current browsers reject cookies.
// In this case, we disregard the HTTP host to be able to set that cookie.
if (substr_count($host, '.') < 1) {
$host = '';
}
setcookie("serendipity[$name]", '', time()-4000, $serendipity['serendipityHTTPPath'], $host);
unset($_COOKIE[$name]);
unset($serendipity['COOKIE'][$name]);