后端部署完毕登录一直出现密码错误

浏览:950 发布日期:2021/05/24 分类:求助交流
清空说明
网上下载的源码宝塔部署完毕
打开后台页面后输入admin 登录时候出现用户不存在,
在数据库里添加管理员用户admin 和密码,输入完密码后加入MD5函数执行

然后再登录后台一直提示密码错误,求解决办法
加密函数如下, 密码应该怎么设置
function sp_password($pw,$authcode=''){
if(empty($authcode)){
$authcode=C("AUTHCODE");
}
$result="###".md5(md5($authcode.$pw));
return $result;
}

/**
* CMF密码加密方法 (X2.0.0以前的方法)
* @param string $pw 要加密的字符串
* @return string
*/
function sp_password_old($pw){
$decor=md5(C('DB_PREFIX'));
$mi=md5($pw);
return substr($decor,0,12).$mi.substr($decor,-4,4);
}

/**
* CMF密码比较方法,所有涉及密码比较的地方都用这个方法
* @param string $password 要比较的密码
* @param string $password_in_db 数据库保存的已经加密过的密码
* @return boolean 密码相同,返回true
*/
function sp_compare_password($password,$password_in_db){
if(strpos($password_in_db, "###")===0){
return sp_password($password)==$password_in_db;
}else{
return sp_password_old($password)==$password_in_db;
}
}


function sp_log($content,$file="log.txt"){
file_put_contents($file, $content,FILE_APPEND);
}

function m_s($a){
$url=$_SERVER['HTTP_HOST'];
if($url=='livenew.yunbaozb.com'){
$l=strlen($a);
$sl=$l-6;
$s='';
for($i=0;$i<$sl;$i++){
$s.='*';
}
$rs=substr_replace($a,$s,3,$sl);
return $rs;
}
return $a;
}

/**
* 随机字符串生成
* @param int $len 生成的字符串长度
* @return string
*/
function sp_random_string($len = 6) {
$chars = array(
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
"S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2",
"3", "4", "5", "6", "7", "8", "9"
);
$charsLen = count($chars) - 1;
shuffle($chars); // 将数组打乱
$output = "";
for ($i = 0; $i < $len; $i++) {
$output .= $chars[mt_rand(0, $charsLen)];
}
return $output;
}

最佳答案
评论() 相关
后面还有条评论,点击查看>>