未验证 提交 3571c476 编写于 作者: Q qkqpttgf 提交者: GitHub

change admin md5 cookie

上级 1bee94cf
...@@ -229,14 +229,14 @@ function main($path) ...@@ -229,14 +229,14 @@ function main($path)
} }
if (getConfig('admin')!='') { if (getConfig('admin')!='') {
if ($_POST['password1']==getConfig('admin')) { if ($_POST['password1']==getConfig('admin')) {
return adminform('admin',md5($_POST['password1']),$url); return adminform('admin', pass2cookie('admin', $_POST['password1']), $url);
} else return adminform(); } else return adminform();
} else { } else {
return output('', 302, [ 'Location' => $url ]); return output('', 302, [ 'Location' => $url ]);
} }
} }
if (getConfig('admin')!='') if (getConfig('admin')!='')
if ( isset($_COOKIE['admin'])&&$_COOKIE['admin']==md5(getConfig('admin')) ) { if ( isset($_COOKIE['admin'])&&$_COOKIE['admin']==pass2cookie('admin', getConfig('admin')) ) {
$_SERVER['admin']=1; $_SERVER['admin']=1;
$_SERVER['needUpdate'] = needUpdate(); $_SERVER['needUpdate'] = needUpdate();
} else { } else {
...@@ -396,7 +396,11 @@ function main($path) ...@@ -396,7 +396,11 @@ function main($path)
$url = proxy_replace_domain($url, $domainforproxy); $url = proxy_replace_domain($url, $domainforproxy);
} }
if ( strtolower(splitlast($files['name'],'.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']); if ( strtolower(splitlast($files['name'],'.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']);
else return output('', 302, [ 'Location' => $url ]); else {
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
$header['Location'] = $url;
return output('', 302, $header);
}
} }
} }
if ( isset($files['folder']) || isset($files['file']) ) { if ( isset($files['folder']) || isset($files['file']) ) {
...@@ -412,6 +416,11 @@ function main($path) ...@@ -412,6 +416,11 @@ function main($path)
} }
} }
function pass2cookie($name, $pass)
{
return md5($name . ':' . md5($pass));
}
function proxy_replace_domain($url, $domainforproxy) function proxy_replace_domain($url, $domainforproxy)
{ {
$tmp = splitfirst($url, '//'); $tmp = splitfirst($url, '//');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册