function reset_set_password($user_info) { $code = kekezu::randomkeys(6); $user_code = md5($code); $slt = kekezu::randomkeys(6); $user_seccode = keke_user_class::get_password($code, $slt); $sql = "update %switkey_member set password = '******' , rand_code = '%s' where uid=%d"; $sql = sprintf($sql, TABLEPRE, $user_code, $slt, $user_info['uid']); $res = db_factory::execute($sql); $sql = "update %switkey_space set password = '******' , sec_code = '%s' where uid=%d"; $sql = sprintf($sql, TABLEPRE, $user_code, $user_seccode, $user_info['uid']); db_factory::execute($sql); $pass_info['code'] = $pass_info['sec_code'] = $code; keke_user_class::user_edit($user_info['username'], '', $code, '', 1); return $pass_info; }
defined('IN_KEKE') or exit('Access Denied'); $strUrl = 'index.php?do=user&view=account&op=password'; if (isset($formhash) && kekezu::submitcheck($formhash)) { $old_pass = kekezu::escape(trim($old_password)); $new_pass = kekezu::escape(trim($new_password)); $confirm_pass = kekezu::escape(trim($confirm_password)); if (md5($old_pass) != $gUserInfo['password']) { $title['errors']['old_password'] = '******'; kekezu::show_msg($title, NULL, NULL, NULL, 'error'); } if ($old_pass === $new_pass) { $title['errors']['new_password'] = '******'; kekezu::show_msg($title, NULL, NULL, NULL, 'error'); } if ($new_pass != $confirm_pass) { $title['errors']['confirm_password'] = '******'; kekezu::show_msg($title, NULL, NULL, NULL, 'error'); } $intRes1 = db_factory::updatetable(TABLEPRE . 'witkey_space', array('password' => md5($new_pass)), array('uid' => $gUid)); $intRes2 = db_factory::updatetable(TABLEPRE . 'witkey_member', array('password' => md5($new_pass)), array('uid' => $gUid)); $flag = keke_user_class::user_edit($gUserInfo['username'], $old_pass, $new_pass, '', 0) > 0 ? 1 : 0; if ($flag && $intRes1 === 1 && $intRes2 === 1) { kekezu::admin_system_log($_SESSION['username'] . '于' . date("Y-m-d H:i:s") . '修改了密码'); keke_msg_class::notify_user($gUserInfo['uid'], $gUserInfo['username'], 'update_password', '修改密码', array('新密码' => $new_pass, '网站名称' => $kekezu->_sys_config['website_name'], '用户名' => $gUserInfo['username']), 2); setcookie('rememberme', ''); unset($_SESSION, $_SESSION['uid'], $_SESSION['username']); unset($_COOKIE['rememberme']); session_destroy(); kekezu::show_msg('新密码已生效', 'index.php?do=login', NULL, NULL, 'ok'); } }
kekezu::admin_system_log($_lang['add_member'] . $fds['username']); kekezu::admin_show_msg($_lang['operate_notice'], "index.php?do=user&view=add", 3, $_lang['user_creat_success'], 'success'); } else { $uinfo = kekezu::get_user_info($edituid); if ($fds['password']) { $slt = db_factory::get_count(sprintf("select rand_code from %switkey_member where uid = '%d'", TABLEPRE, $edituid)); $sec_code = keke_user_class::get_password($fds['password'], $slt); $fds['sec_code'] = $sec_code; $newpwd = $fds['password']; $pwd = md5($fds['password']); $fds[password] = $pwd; db_factory::execute(sprintf("update %switkey_member set password ='******' where uid=%d", TABLEPRE, $pwd, $edituid)); } else { unset($fds['password']); } keke_user_class::user_edit($uinfo['username'], '', $newpwd, '', 1); $space_class->save($fds, array("uid" => "{$edituid}")); kekezu::admin_system_log($_lang['edit_member'] . $member_arr[username]); kekezu::admin_show_msg($_lang['edit_success'], "index.php?do=user&view=add&edituid=" . $edituid, 3, '', 'success'); } } if ($check_email) { $regClass = new keke_register_class(); $result = $regClass->check_email($check_email); if ($result !== true) { echo $result; } else { echo 1; } die; }
<?php defined('IN_KEKE') or exit('Access Denied'); $uid and header("location:index.php"); $strPageTitle = '重置密码' . '- ' . $_K['html_title']; $authstatus = false; $validInfo = keke_user_class::getPwdAuth($authsid, $encrypteuid); if ($_SESSION['retrieve']['validinfo']['http_agent'] == $_SERVER['HTTP_USER_AGENT'] && is_array($validInfo) && $validInfo && $authsid == $_SESSION['retrieve']['validinfo']['authsid']) { $authstatus = true; } $validInfo['userinfo'] = kekezu::get_user_info($validInfo['get_uid']); if (kekezu::submitcheck($formhash)) { $newpwd = trim($newpwd); $newpwd2 = trim($newpwd2); if ($newpwd != $newpwd2) { $tips['errors']['newpwd'] = '您输入的密码与确认密码不一致'; kekezu::show_msg($tips, NULL, NULL, NULL, 'error'); } $user_code = md5($newpwd); $sql1 = sprintf("update %switkey_member set password = '******' where uid=%d", TABLEPRE, $user_code, $validInfo['userinfo']['uid']); db_factory::execute($sql1); $sql2 = sprintf("update %switkey_space set password = '******' where uid=%d", TABLEPRE, $user_code, $validInfo['userinfo']['uid']); db_factory::execute($sql2); keke_user_class::user_edit($validInfo['userinfo']['username'], '', $newpwd, '', 1); keke_user_class::updateGetPwdStatusByGetUid($validInfo['userinfo']['uid'], 1); unset($_SESSION['retrieve']); unset($_SESSION); kekezu::show_msg('密码修改成功', "index.php?do=login", NULL, NULL, 'ok'); }