Simple is fine. I hope you can tell me what method to use to do it and give you some ideas. Thank you.
逸先生2017-08-30 12:47:16
$user = "xx"; $pass = "xx"; $waittime = 241231; //根据$user在数据库中查询出来的时间 $times = 0; //根据$user在数据库中查询出来的尝试次数 if ((time() - $waittime) > 0) { if (/*根据user和pass去数据库查询*/) { //账号和密码存在 //登陆成功 //数据库中 waittime = 0;times= 0; } else { //账号和密码不存在 //登陆失败 //数据库中 times= $times+1; if (($times + 1) == 3) { //数据库中 times= 0;waittime = time() + 30 * 60(当前时间+半小时); } } } else { //提示 还需等待$waittime - time() 秒 }
逸先生2017-08-30 10:44:24
When you talk about limiting the number of logins, do you mean to limit the number of logins per day, or do you mean that once a person logs in, he cannot log in again when he is online? If it is restricted, one person can log in 5 times a day. It can be designed like this. Add a field to the user table, login_times tinyint (1). Every time you log in, it will be judged whether the value is greater than or equal to 5. If it is less than 5, the login is successful and the number of times is increased by one. The server uses scheduled tasks. This value will be set every early morning. Data cleared 0