我可以使用mod_auth_mysql使用上次登录时间戳更新我的用户数据库吗?

时间:2014-04-10 20:01:03

标签: mysql apache .htaccess apache-modules

环境:

LAMP(CentOS 6.5,Apache 2.2.15-30.el6.centos,MySQL 5.5.36-1.el6.remi,PHP 5.4.26-1.el6.remi)

我安装了mod_auth_mysql并且工作正常。我正在使用.htaccess文件限制基于组的用户访问。数据库结构是无关紧要的,但无论如何我都会发布:

table: user_auth
user_name       varchar(25)
user_passwd     varchar(40)
last_modified   timestamp
last_login      timestamp

我的auth_mysql.conf非常简单和通用。它看起来像这样:

<Directory /var/www/html/>
 AuthName "My Website"
 AuthType Basic
 AuthMYSQLEnable on
 AuthMySQLHost localhost
 AuthMySQLUser user
 AuthMySQLPassword pass
 AuthMySQLDB authDB
 AuthMySQLUserTable user_auth
 AuthMySQLNameField user_name
 AuthMySQLPasswordField user_passwd
 AuthMySQLGroupTable user_groups
 AuthMySQLGroupField user_group
</Directory>

所以,我的问题是:当使用mod_auth_mysql验证登录时,是否可以修改auth_mysql.conf,.htaccess,MySQL触发器等来为user_auth表中的last_login列添加时间戳?我似乎无法在任何地方找到关于此的信息,或者也许我;我只是没有使用正确的关键字。任何帮助,将不胜感激。提前谢谢。

1 个答案:

答案 0 :(得分:0)

您可以创建并注册将更新时间戳的UDF函数。 然后你可以把这个函数放到modauthmysql的AuthMySQLUserCondition中。

可能更容易简单地修改modauthmysql。