How We Can Register New User For Any Appication

hii all,

  i need to know that i develop one application in yii in which i gave all functionality to see user after login but we need another one funtionality is when user is new and he want to register him self and after that all functionality he can see than what to do?


  please reply me in step by step because i am new in yii.

thanks in advance,

jalpa patel

Hi Jalpa,

I think you want to create the session for particular user login and data will be fetch the session id wise.

thanks for give me answer but i can not exactly know the code of session so can you please elaborate the code, so that i can understand it easily…

Please read this session tutorial

You can write a User Identity in component folder after login,create the session

for e.g




public function authenticate()

	{

		$email = $this->username;

		$password=md5($this->password);

		$criteria = new CDbCriteria();

		$criteria->condition  = ' t.user_type IN(\'user\',\'blogger\',\'company\') AND t.email= \''.$email.'\' AND  t.`password` = \''.$password.'\' AND  t.`status` = "1"';

		$vkuser = VkUsers::model()->find($criteria);

		

		//$customer=customer::model()->findByAttributes(array('email'=>$email),$criteria);


		//p($vkuser);

		if($vkuser===null) {

			$this->errorCode=self::ERROR_EMAIL_INVALID;

		} else if(Yii::app()->getModule('vkuser')->encrypting($this->password)!==$vkuser->password) {

			$this->errorCode=self::ERROR_PASSWORD_INVALID;

		} else if($vkuser->status>1&&Yii::app()->getModule('vkuser')->loginNotActiv==false) {

			$this->errorCode=self::ERROR_STATUS_NOTACTIV;

		} else if($vkuser->status==2) {

			$this->errorCode=self::ERROR_STATUS_BAN;

		} else {

			$this->_id		= $vkuser->id;

			$this->email	= $vkuser->email;

			$this->username	= $vkuser->email;

			$this->errorCode= self::ERROR_NONE;

			Yii::app()->vkuser->setId($this->_id);

			Yii::app()->vkuser->guestName = $vkuser->email;

			$userData = $vkuser->attributes;

			$userData['fname'] = $vkuser->fname;

			Yii::app()->vkuser->setState('vkuser',$userData);

			

			

		}

		return !$this->errorCode;

	}

in this code I create the VKuser module and write the session





$userData = $vkuser->attributes;

 $userData['fname'] = $vkuser->fname;

Yii::app()->vkuser->setState('vkuser',$userData);

I hope it;s help.