External Session

I am newbie in yii framework. I want how to use external session in yii applications, I have a simple php session, in that php page add link to yii application . I want that php session will continued in yii application . I don’t know how can do it. Please any one can help me. sorry for my poor english…

Hi,

what data you have in your session that you want to use in Yii app??

user data or some cart information??

just read following article you will get all about use of session in Yii.

Using Sessions with the Yii Framework by larryulman.

session lives in the connection between ur browser and the web server.

when you click a hyperlink, the page_a changes to page_b.

if page_a and page_b belongs to the same web server, the session is shared.

else, the session can’t be shared. but you can pass it by GET or POST.

Ok. But web server is same, how can i page_a login session continued in yii framework without login…

see the CWebUser source code. when login, Yii set too session indexed by ‘__id’ and ‘__name’. So if you have set this two session, u can say you have done the yii login.

after the session is set, you try printing the value of Yii::app()->user->id or Yii::app()->user->name and see what happens. maybe you should also check the Yii::app()->user->isGuest().




  /**

         * @param mixed $value the unique identifier for the user. If null, it means the user is a guest.

         */

        public function setId($value)

        {

                $this->setState('__id',$value);

        }


        /**

         * Returns the unique identifier for the user (e.g. username).

         * This is the unique identifier that is mainly used for display purpose.

         * @return string the user name. If the user is not logged in, this will be {@link guestName}.

         */

        public function getName()

        {

                if(($name=$this->getState('__name'))!==null)

                        return $name;

                else

                        return $this->guestName;

        }




What you actually need is SSO.

i require to the external login authentication using php and redirect to welcome.php, that page i put link to yii application. when click the link, that login credentials are automatically login in yii application. i attached my php login file. thank you. sorry for my english,