To make the Yii login script (from the blog tutorial) more secure, I want to have it update a few fields in a db table called login (last ip logged in from, logincount, logintime, etc.). I’m trying to do it from the authenticate() function in UserIdentity.php, but what’s the best way to pass the current IP to UserIdentity? I can’t call getenv(“REMOTE_ADDR”) from there, but I can’t figure out how to pass it in (or if this is a good place to do it).
You can use CHttpRequest::getUserHostAddress() to retrieve the ip address.
Ah, thanks to the both of you, this should help me work something out.
I think I solved the problem with this, in my LoginForm model.It’s not working consistently though.