Yii has a wonderful AuthManager built in, but it's a little confusing to use so many people end up creating their own. This one drove me a little nuts for a bit, so I thought it would be a good place to start. For the purposes here, I'm going to assume you've already added a db setting to your main Controller. For more information on how to do that, read here.
This is the starting point for today's adventure: http://www.yiiframework.com/doc/guide/topics.auth
The article above walks you through adjusting the UserIdentity (found in /protected/components/UserIdentity.php ) to pull information from a database table for users, override the ID of the UserIdentity class and set up some basic authentication rules, but you have to read between the lines to get it all complete.