PHP MySQL存储登录历史记录 [英] PHP MySQL Storing a login history
本文介绍了PHP MySQL存储登录历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个网站的现有PHP MYSQL登录系统.我想记录每个用户登录的历史记录,包括失败的尝试.
I have an existing PHP MYSQL login system for a site. I want to record the history of every user login including failed attempts.
我想在历史记录中捕获以下数据:
I want to capture the following data on the history:
- 使用的用户名
- 登录时间
- 登录日期
- 成功-(回答是或否)
如何在不更改整个现有登录系统的情况下执行此操作?
How can I do this without changing my entire existing login system?
推荐答案
使用该信息创建一个新表,并在用户登录时插入...
Create a new table with that info and insert when user logins ...
CREATE TABLE `login_info` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`username` VARCHAR( 50 ) NOT NULL ,
`date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
`success` ENUM( 'yes', 'no' ) NOT NULL
);
我不明白为什么你需要分开的时间和日期...
I didn't understand why you need time and date separately ...
这篇关于PHP MySQL存储登录历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文