Try to solve a cookie problem when using s9y with domains like 'localhost'

This commit is contained in:
Garvin Hicking 2007-06-13 09:36:26 +00:00
parent 734afacb50
commit 5feb8559ba

View File

@ -615,6 +615,13 @@ function serendipity_setCookie($name, $value, $securebyprot = true) {
} else {
$secure = false;
}
// 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) {
$host = '';
}
setcookie("serendipity[$name]", $value, time()+60*60*24*30, $serendipity['serendipityHTTPPath'], $host, $secure);
$_COOKIE[$name] = $value;
$serendipity['COOKIE'][$name] = $value;