O'Reilly logo

PHP 5 CMS Framework Development by Martin Brampton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Keeping session data tidy

Our session data handler can be asked to delete a session, a process that follows similar logic to the one just described:

public function sess_destroy ($session_id) {
setcookie ('aliroTempSession', null, time()-7*24*60*60, '/');
if (!isset($_COOKIE['aliroCookieCheck']) OR !isset($this->db)) return true;
$session_id = $this->db->getEscaped($session_id);
$this->db->doSQL("DELETE FROM #__session_data WHERE session_ id_crc = CRC32('$session_id') AND session_id = '$session_ id'");
return true;
}

As you can see, deletion is simpler than reading, since the temporary session data cookie can be deleted regardless of whether it presently exists. Provided cookies are accepted and the database is available, the relevant ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required