public function write($id, $cargo)
 {
     extract($this->config);
     // if the session is set to never expire
     // we will set it to 1 year
     if ($lifetime == 0) {
         $lifetime = 3600 * 24 * 365;
     }
     // serialize data into a srting
     $serialized = serialize($cargo);
     // create a signature to verify content when unpacking
     $sign = hash('md5', $serialized);
     // encode all the data
     $data = base64_encode($sign . $serialized);
     C::write($cookie . '_payload', $data, $lifetime, $path, $domain, $secure);
 }
Ejemplo n.º 2
0
 /**
  * Implementation of the write method, commits the session
  * data using the storage driver
  */
 public function write()
 {
     extract($this->driver->config);
     // if the session is set to never expire
     // we will set it to 1 year
     if ($lifetime == 0) {
         $lifetime = 3600 * 24 * 365;
     }
     // save session ID
     Cookie::write($cookie, $this->id, $expire_on_close ? 0 : $lifetime);
     // rotate flash data
     $this->put('_out', $this->get('_in', array()));
     $this->put('_in', array());
     // write payload to storage driver
     $this->driver->write($this->id, $this->data);
 }
Ejemplo n.º 3
0
 /**
  * Delete a session by ID.
  *
  * @param  string  $id
  * @return void
  */
 public function delete($id)
 {
     \System\Cookie::forget('session_payload');
 }