Problem In Session

Can somebody tell me how does the authentication and session works… and how to implement it on log-in and log-out

I write this code on config/main.php inside components


            'class' => 'CDbHttpSession',

            'connectionID' => 'db',

            'sessionTableName' => 'dbsession',


in LoginController i have this

public function actionLogin()


		if (Yii::app()->user->isGuest) {

			$model=new UserLogin;

			// collect user input data




				// validate user input and redirect to previous page if valid

				if($model->validate()) {

                                    Yii::app()->session['var']='value';//is this right?


					if (Yii::app()->getBaseUrl()."/index.php" === Yii::app()->user->returnUrl)








			// display the login form


		} else




And to my Logout COntroller

public function actionLogout()








I have this codes but… while im log in. i copy one of my url that has a view/displays data, then i logout. when i paste it on the url browser. i access the view/displays data while i am not logged in. So it means that all people can view my data which is needed to be secured and only admin can view it…

Kindly help me. Thanks.

What you mean by this ??

Do, you want to give access to see your view page to certain users only like only for logged in User.if it is then you need to check ACL component of yii.You can go to this link and get more idea about it