Destroy session if exists

Hi,

I have two pages - start & finish.

A session is set on finish using:




      // Init new session object

      $this->searchSession = new CHttpSession;

      

      // Set timeout for session data in seconds

      $this->searchSession->setTimeout(1800);

      

      // Starts the session if it has not started yet.

      $this->searchSession->open(); 



If someone navigates to start I want to check whether a session is set and if so destroy it. How can I check that a session is set?

And if it is set would i use this code to destroy it?:




      $this->searchSession = new CHttpSession;

      $this->searchSession->destroy();



Hi guys, any help with this one?

My only thought is to check whether a particular var isset and use that as an indicator that a session isset.

J

why you don’t use ?




Yii::app()->session;






Yii::app()->session->destroy();