From: garvinhicking Date: Wed, 13 Jun 2007 09:36:26 +0000 (+0000) Subject: Try to solve a cookie problem when using s9y with domains like 'localhost' X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=caf3f9ed9807b37e6936e4e8dc5d2d79306457c1;p=s9y.git Try to solve a cookie problem when using s9y with domains like 'localhost' --- diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php index f9dcb83..6225822 100644 --- a/include/functions_config.inc.php +++ b/include/functions_config.inc.php @@ -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;