From 2fc00b7a8d7b0f3b1ed848b3a1c2e878d7062a86 Mon Sep 17 00:00:00 2001 From: filesite Date: Sat, 8 Oct 2022 23:16:12 +0800 Subject: [PATCH] hide user's ip for admin login record --- conf/app.php | 3 +++ controller/ApiController.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/app.php b/conf/app.php index 908b468..c84836e 100644 --- a/conf/app.php +++ b/conf/app.php @@ -43,6 +43,9 @@ return array( 'contact' => 'FileSite视频网站订制联系:FileSite.io', ), + //md5加密前缀 + 'md5Prefix' => 'some_code_here', + //后台管理相关配置 'admin' => array( 'username' => 'filesite', diff --git a/controller/ApiController.php b/controller/ApiController.php index e14a0cf..9e50589 100644 --- a/controller/ApiController.php +++ b/controller/ApiController.php @@ -365,7 +365,7 @@ Class ApiController extends Controller { $ip = $this->getUserIp(); $logDir = __DIR__ . '/../runtime/admin/'; - $logFile = "{$logDir}{$ip}.cache"; + $logFile = "{$logDir}" . md5(FSC::$app['config']['md5Prefix'] . $ip) . ".cache"; try { if (file_exists($logFile)) { @@ -379,7 +379,7 @@ Class ApiController extends Controller { protected function saveAdmUserData($data) { $ip = $this->getUserIp(); $logDir = __DIR__ . '/../runtime/admin/'; - $logFile = "{$logDir}{$ip}.cache"; + $logFile = "{$logDir}" . md5(FSC::$app['config']['md5Prefix'] . $ip) . ".cache"; if (!is_dir($logDir)) { //try to mkdir @mkdir($logDir, 0700, true); }