structur

hi friend, this code




//UserIdentity.php

$user = User::model()->findByAttributes(array('email'=>$this->username));

   if ($user === null) {

8 $this->errorCode=self::ERROR_USERNAME_INVALID;

9 } else if ($user->pass !== hash_hmac('sha256',

10 $this->password,

11 Yii::app()->params['encryptionKey']) ) {

12 $this->errorCode=self::ERROR_PASSWORD_INVALID;

13 } else { // Okay!

14 $this->errorCode=self::ERROR_NONE;

15 $this->setState('type', $user->type);

16 $this->_id = $user->id;

17 }

18 return !$this->errorCode;

19 }

20 public function getId() {

21



#ask

array(‘email’=>$this->username)

1.‘email’, get from database or view?

2.$this->username , get from database or view?

  1. === dan !=== , equels 3x, what’s mean it? my know like this ==, 2x



//SiteController.php

$model->attributes= $_POST['User'];



1.$model->attributes, what’s mean?is it get all attributes that set on User.php

2.$_POST[‘User’] = ???get all value on view.php

than the last question

so, how log in with database, If someone login name there is in database or register not same name?

regards.

CUserIdentity.php has an attribute called $username

http://www.yiiframework.com/doc/api/1.1/CUserIdentity

This is a useful method to set the model attribute values in a massive way. You can do this instead, but it’s longer:

$model->name = $_POST['User][‘name’];

$model->password = $_POST[‘User’][‘password’];

!=== doesn’t exist. It should be !==

http://stackoverflow.com/questions/80646/how-do-the-php-equality-double-equals-and-identity-triple-equals-comp