setActive (); $this->setAffiliateId ($_GET ['aff']); $this->attachCookie (); } elseif (isset ($_COOKIE ['aff'])) { $this->setActive (); $this->setAffiliateId ($_COOKIE ['aff']); } } protected function attachCookie () { { $uri = Zend_Uri_Http::fromString (url::getSiteRootUrl ()); $parts = explode ('.', $uri->getHost()); if (count ($parts) > 2) { $parts [0] = ''; } $domain = join ('.', $parts); } setcookie ('aff', $this->getAffiliateId (), strtotime ('+1 year'), '/', $domain); } function setActive ($active = true) { $this->active = $active; } function getActive () { return $this->active; } function setAffiliateId ($affiliate_id) { $this->affiliate_id = $affiliate_id; } function getAffiliateId () { return $this->affiliate_id; } }