1

试图为我的 cakephp 应用程序开发某种登录跟踪器。

我知道我需要如下代码:

$this->data['LoginSession']['username'] = $_SERVER['REMOTE_ADDR'];
$this->data['LoginSession']['ipAddress'] = $_SERVER['REMOTE_ADDR'];
$this->LoginSession->save($this->data);

...在(我猜)users_controller,但不知道具体在哪里。

我也想跟踪成功但不成功的登录。

你能帮我解决这个问题吗?先感谢您!

4

1 回答 1

0

你已经有登录功能了吗?

function login() {
    if ($this->Auth->user()) {
        //do your tracking stuff/DB call here
        $this->redirect($this->Auth->redirect());
    }
}
于 2010-06-15T22:41:12.007 回答