Index: branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php =================================================================== diff -u -r7062 -r7092 --- branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 7062) +++ branches/unlabeled/unlabeled-1.68.2/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 7092) @@ -122,7 +122,7 @@ // process "Save Username" checkbox $save_username = $this->Application->GetVar('cb_save_username') ? $login_value : ''; - setcookie('save_username', $save_username); + $this->Application->Session->SetCookie('save_username', $save_username, adodb_mktime() + 31104000); // 1 year expiration $this->Application->SetVar('save_username', $save_username); // cookie will be set on next refresh, but refresh won't occur if login error present, so duplicate cookie in HTTPQuery if ($this->Application->IsAdmin() && ($login_value == 'root')) { Index: branches/unlabeled/unlabeled-1.52.4/core/kernel/session/session.php =================================================================== diff -u -r6864 -r7092 --- branches/unlabeled/unlabeled-1.52.4/core/kernel/session/session.php (.../session.php) (revision 6864) +++ branches/unlabeled/unlabeled-1.52.4/core/kernel/session/session.php (.../session.php) (revision 7092) @@ -488,21 +488,26 @@ else { //Otherwise we still suppose cookies are on, because may be it's the first time user visits the site //So we send cookies on to get it next time (when referal will tell us if they are realy off - setcookie( - 'cookies_on', - 1, - adodb_mktime()+31104000, //one year should be enough - $this->CookiePath, - $this->CookieDomain, - $this->CookieSecure - ); + $this->SetCookie('cookies_on', 1, adodb_mktime() + 31104000); //one year should be enough } } else $this->CookiesEnabled = true; return $this->CookiesEnabled; } + /** + * Sets cookie for current site using path and domain + * + * @param string $name + * @param mixed $value + * @param int $expires + */ + function SetCookie($name, $value, $expires = null) + { + setcookie($name, $value, $expires, $this->CookiePath, $this->CookieDomain, $this->CookieSecure); + } + function Check() { // we should check referer if cookies are disabled, and in combined mode @@ -663,15 +668,7 @@ */ function SetSessionCookie() { - setcookie( - $this->CookieName, - $this->SID, - $this->Expiration, - $this->CookiePath, - $this->CookieDomain, - $this->CookieSecure - ); - + $this->SetCookie($this->CookieName, $this->SID, $this->Expiration); $_COOKIE[$this->CookieName] = $this->SID; // for compatibility with in-portal }