Browse Source

hide user's ip for admin login record

master
filesite 2 years ago
parent
commit
2fc00b7a8d
  1. 3
      conf/app.php
  2. 4
      controller/ApiController.php

3
conf/app.php

@ -43,6 +43,9 @@ return array( @@ -43,6 +43,9 @@ return array(
'contact' => 'FileSite视频网站订制联系:<a href="https://filesite.io" target="_blank">FileSite.io</a>',
),
//md5加密前缀
'md5Prefix' => 'some_code_here',
//后台管理相关配置
'admin' => array(
'username' => 'filesite',

4
controller/ApiController.php

@ -365,7 +365,7 @@ Class ApiController extends Controller { @@ -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 { @@ -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);
}

Loading…
Cancel
Save