fixed cookie prob for setup too

This commit is contained in:
Ralf Becker 2004-05-01 09:58:38 +00:00
parent e9c2659778
commit 99303481a2

View File

@ -76,28 +76,16 @@
*/ */
function set_cookiedomain() function set_cookiedomain()
{ {
$dom = $_SERVER['HTTP_HOST']; $this->cookie_domain = $_SERVER['HTTP_HOST'];
if (preg_match("/^(.*):(.*)$/",$dom,$arr))
// remove port from HTTP_HOST
if (preg_match("/^(.*):(.*)$/",$this->cookie_domain,$arr))
{ {
$dom = $arr[1]; $this->cookie_domain = $arr[1];
} }
$parts = explode('.',$dom); if (count(explode('.',$this->cookie_domain)) <= 1)
if (count($parts) > 2)
{
if (!ereg('[0-9]+',$parts[1]))
{
for($i=1;$i<count($parts);$i++)
{
$this->cookie_domain .= '.'.$parts[$i];
}
}
else
{
$this->cookie_domain = '';
}
}
else
{ {
// setcookie dont likes domains without dots, leaving it empty, gets setcookie to fill the domain in
$this->cookie_domain = ''; $this->cookie_domain = '';
} }
} }