1 changed files with 70 additions and 0 deletions
@ -0,0 +1,70 @@ |
|||||
|
<?php |
||||
|
// 清除cookie_file目录下所有文件 |
||||
|
$dir = __DIR__ . '/../cookie_file/'; |
||||
|
$list = scandir($dir); |
||||
|
foreach($list as $v) { |
||||
|
if($v == '.' || $v == '..') { |
||||
|
continue; |
||||
|
} |
||||
|
echo $dir.$v.PHP_EOL; |
||||
|
|
||||
|
// 服务器被禁 server_ban.txt 文件 |
||||
|
if($v == 'server_ban.txt') { |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
// 停用账号 ban_* 账号文件 |
||||
|
if(strpos($v, 'ban_') === 0) { |
||||
|
// 时间超过3小时 |
||||
|
if(filemtime($dir.$v) < time()-3600*3){ |
||||
|
$arr_file_name = explode('_', $v); |
||||
|
$user = $arr_file_name[1]; |
||||
|
|
||||
|
$need_login_file = $dir.'needlogin_'.$user; |
||||
|
//unlink($need_login_file); |
||||
|
//改名 |
||||
|
rename($need_login_file, str_replace('needlogin_', 'del_needlogin_', $need_login_file)); |
||||
|
|
||||
|
$fail_login_file = $dir.'fail_'.$user; |
||||
|
//unlink($fail_login_file); |
||||
|
//改名 |
||||
|
rename($fail_login_file, str_replace('fail_', 'del_fail_', $fail_login_file)); |
||||
|
|
||||
|
//unlink($dir.$v); |
||||
|
rename($dir.$v, str_replace('ban_', 'del_ban_', $dir.$v)); |
||||
|
// 记录日志 |
||||
|
$str_log = date('Y-m-d H:i:s')."|删除停用账号文件|".$user; |
||||
|
file_put_contents($log_file, $str_log . PHP_EOL, FILE_APPEND); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 登录失败 fail_* 账号文件 |
||||
|
if(strpos($v, 'fail_') === 0) { |
||||
|
$arr_fail_info = explode("\n", file_get_contents($dir.$v)); |
||||
|
if($arr_fail_info[0]+0 >=15) { |
||||
|
// 时间超过2小时 |
||||
|
if(filemtime($dir.$v) < time()-3600*2) { |
||||
|
$arr_file_name = explode('_', $v); |
||||
|
$user = $arr_file_name[1]; |
||||
|
|
||||
|
$need_login_file = $dir.'needlogin_'.$user; |
||||
|
//unlink($need_login_file); |
||||
|
//改名 |
||||
|
rename($need_login_file, str_replace('needlogin_', 'del_needlogin_', $need_login_file)); |
||||
|
|
||||
|
$fail_login_file = $dir.'fail_'.$user; |
||||
|
//unlink($fail_login_file); |
||||
|
//改名 |
||||
|
rename($fail_login_file, str_replace('fail_', 'del_fail_', $fail_login_file)); |
||||
|
|
||||
|
//unlink($dir.$v); |
||||
|
rename($dir.$v, str_replace('fail_', 'del_fail_', $dir.$v)); |
||||
|
// 记录日志 |
||||
|
$str_log = date('Y-m-d H:i:s')."|删除登录失败账号文件|".$user; |
||||
|
file_put_contents($log_file, $str_log . PHP_EOL, FILE_APPEND); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
Loading…
Reference in new issue