public function activate() { $path = $this->config('location'); $expire = (int) $this->config('expire'); $cookiesecure = $this->config('secure'); $name = $this->config('name') ? (string) $this->config('name') : DevString::random(); $this->_source = HTTP::cookie($name, "", $expire, $path = null, $cookiesecure) ? $name : null; if (!$this->_source) { $this->status(self::STATUS_FAILED_INIT); } else { $this->status(self::STATUS_SUCCESSFUL_INIT); } }
public function activate() { $path = $this->config('location'); $name = $this->config('name') ? (string) $this->config('name') : DevString::random(); $expire = (int) $this->config('expire'); $secure = $this->config('secure'); $this->_source = $name; $id = session_id(); if ($id == "") { $domain = $path ? substr($path, 0, strpos($path, '/')) : HTTP::domain(); $dir = $path ? substr($path, strpos($path, '/'), strlen($path)) : '/'; $cookiedie = DevNumber::isValid($expire) ? time() + (int) $expire : (int) $expire; //expire in one hour $secure = (bool) $secure; session_set_cookie_params($cookiedie, $dir, $domain, $secure); session_start($this->_source); if (session_id()) { $this->_source = $name; } } if (!$this->_source) { $this->status(self::STATUS_FAILED_INIT); } }