try to fix encrypt cache

pull/31/head
qkqpttgf 2020-03-03 15:17:38 +08:00 committed by GitHub
parent 46a8466b57
commit 1a7358672c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -270,7 +270,8 @@ function encode_str_replace($str)
function gethiddenpass($path,$passfile) function gethiddenpass($path,$passfile)
{ {
$password=getcache('path_' . $path . '/?password'); $path1 = path_format($_SERVER['list_path'] . path_format($path));
$password = getcache('path_' . $path1 . '/?password');
if ($password=='') { if ($password=='') {
$ispassfile = fetch_files(spurlencode(path_format($path . '/' . $passfile),'/')); $ispassfile = fetch_files(spurlencode(path_format($path . '/' . $passfile),'/'));
//echo $path . '<pre>' . json_encode($ispassfile, JSON_PRETTY_PRINT) . '</pre>'; //echo $path . '<pre>' . json_encode($ispassfile, JSON_PRETTY_PRINT) . '</pre>';
@ -280,14 +281,14 @@ function gethiddenpass($path,$passfile)
$passwordf=explode("\n",$arr['body']); $passwordf=explode("\n",$arr['body']);
$password=$passwordf[0]; $password=$passwordf[0];
$password=md5($password); $password=md5($password);
savecache('path_' . $path . '/?password', $password); savecache('path_' . $path1 . '/?password', $password);
return $password; return $password;
} else { } else {
//return md5('DefaultP@sswordWhenNetworkError'); //return md5('DefaultP@sswordWhenNetworkError');
return md5( md5(time()).rand(1000,9999) ); return md5( md5(time()).rand(1000,9999) );
} }
} else { } else {
savecache('path_' . $path . '/?password', 'null'); savecache('path_' . $path1 . '/?password', 'null');
if ($path !== '' ) { if ($path !== '' ) {
$path = substr($path,0,strrpos($path,'/')); $path = substr($path,0,strrpos($path,'/'));
return gethiddenpass($path,$passfile); return gethiddenpass($path,$passfile);
@ -793,8 +794,8 @@ function adminoperate($path)
return output($result['body'], $result['stat']); return output($result['body'], $result['stat']);
} }
if ($_GET['RefreshCache']) { if ($_GET['RefreshCache']) {
$path1 = path_format($_SERVER['list_path'] . path_format($path));
savecache('path_' . $path1 . '/?password', '', 1); savecache('path_' . $path1 . '/?password', '', 1);
savecache('path_' . $path . '/?password', '', 1);
return message('<meta http-equiv="refresh" content="2;URL=./">', getconstStr('RefreshCache'), 302); return message('<meta http-equiv="refresh" content="2;URL=./">', getconstStr('RefreshCache'), 302);
} }
return $tmparr; return $tmparr;