Yii Authentication and Authorization
<p>I followed steps in this article <a href="http://www.yiiframework.com/doc/guide/1.1/en/topics.auth" rel="nofollow">http://www.yiiframework.com/doc/guide/1.1/en/topics.auth</a> how create login and registration system on my site, but I don't understand where should I put this code, in what file?? </p>

<pre><code>$identity=new UserIdentity($username,$password);
if($identity-&gt;authenticate())
    Yii::app()-&gt;user-&gt;login($identity);
else
    echo $identity-&gt;errorMessage;
......
// Logout the current user
Yii::app()-&gt;user-&gt;logout();
</code></pre>