eyoucms易优修改重置后台密码小工具
更新日期:2024-09-19 19:05:57 来源:网络
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>密码修改工具 - 易优CMS</title>
</head>
<body>
<?php
error_reporting(E_ALL & ~E_NOTICE);
header('Content-Type: text/html; charset=UTF-8');
$database = include_once "application/database.php";
$dbHost = trim($database['hostname']);
$dbport = $database['hostport'] ? $database['hostport'] : '3306';
$dbName = trim($database['database']);
$dbUser = trim($database['username']);
$dbPwd = trim($database['password']);
$dbPrefix = empty($database['prefix']) ? 'ey_' : trim($database['prefix']);
$charset = trim($database['charset']);
$conn = @mysqli_connect($dbHost, $dbUser, $dbPwd,$dbName,$dbport);
if (mysqli_connect_errno($conn)){
$msg = "连接数据库失败!".mysqli_connect_error($conn);
tips($msg);
}
mysqli_set_charset($conn, $charset);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$type = $_POST['type'];
if (1 == $type) { // 修改后台登录密码
$user_name = $_POST['user_name'];
$password = $_POST['password'];
if (empty($password)) {
tips("新密码不能为空!");
}
$config = include_once "application/config.php";
$auth_code = $config['AUTH_CODE'];
$sql = "SELECT value FROM `{$dbPrefix}config` WHERE name='system_auth_code' AND inc_type='system' LIMIT 1";
$ret = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($ret))
{
if (!empty($row['value'])) {
$auth_code = $row['value'];
}
}
$password = md5($auth_code.$password);
$sql = "UPDATE `{$dbPrefix}admin` SET `password`='{$password}' WHERE `user_name`='{$user_name}'";
$ret = mysqli_query($conn,$sql);
if ($ret) {
$msg = "修改成功";
} else {
$msg = "修改失败,请联系技术!";
}
tips($msg);
}
else if (2 == $type) // 修改插件安装密码
{
$password = $_POST['password'];
if (empty($password)) {
tips("新密码不能为空!");
}
$config = include_once "application/config.php";
$auth_code = $config['AUTH_CODE'];
$sql = "SELECT value FROM `{$dbPrefix}config` WHERE name='system_auth_code' AND inc_type='system' LIMIT 1";
$ret = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($ret))
{
if (!empty($row['value'])) {
$auth_code = $row['value'];
}
}
$password = md5($auth_code.$password);
$t = time();
$sql = "UPDATE `{$dbPrefix}config` SET `value`='{$password}', `update_time`='{$t}' WHERE `name`='weapp_installpwd' AND `inc_type`='weapp'";
$ret = mysqli_query($conn,$sql);
if ($ret) {
delFile('./data/runtime/cache', true);
$msg = "修改成功";
} else {
$msg = "修改失败,请联系技术!";
}
tips($msg);
}
else if (3 == $type) // 修改插件问题与答案
{
$ask = $_POST['ask'];
if (empty($ask)) {
tips("新问题不能为空!");
}
$answer = $_POST['answer'];
if (empty($answer)) {
tips("新答案不能为空!");
}
$config = include_once "application/config.php";
$auth_code = $config['AUTH_CODE'];
$sql = "SELECT value FROM `{$dbPrefix}config` WHERE name='system_auth_code' AND inc_type='system' LIMIT 1";
$ret = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($ret))
{
if (!empty($row['value'])) {
$auth_code = $row['value'];
}
}
$answer = md5($auth_code.$answer);
$t = time();
$sql = "UPDATE `{$dbPrefix}setting` SET `value`='{$ask}', `update_time`='{$t}' WHERE `name`='weapp_install_ask' AND `inc_type`='weapp'";
$sql2 = "UPDATE `{$dbPrefix}setting` SET `value`='{$answer}', `update_time`='{$t}' WHERE `name`='weapp_install_answer' AND `inc_type`='weapp'";
if (@mysqli_query($conn,$sql) && @mysqli_query($conn,$sql2)) {
delFile('./data/runtime/cache', true);
$msg = "修改成功";
} else {
$msg = "修改失败,请联系技术!";
}
tips($msg);
}
} else {
/*系统版本号*/
$version = 'v1.0.0';
$version_txt_path = './data/conf/version.txt';
if(file_exists($version_txt_path)) {
$fp = fopen($version_txt_path, 'r');
$content = fread($fp, filesize($version_txt_path));
fclose($fp);
$version = $content ? $content : $version;
}
/*end*/
/*管理员列表*/
$sql = "SELECT * FROM `{$dbPrefix}admin`";
$ret = mysqli_query($conn,$sql);
$select_html = "";
while($row = mysqli_fetch_array($ret))
{
$select_html .= "<option value='{$row['user_name']}'>{$row['user_name']}</option>";
}
/*end*/
/*插件问题列表*/
$weapp_askanswer_list = [];
$sql = "SELECT value FROM `{$dbPrefix}setting` WHERE name='weapp_askanswer_list' AND inc_type='weapp' LIMIT 1";
$ret = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($ret))
{
if (!empty($row['value'])) {
$weapp_askanswer_list = json_decode($row['value'], true);
}
}
$ask_select_html = "";
foreach ($weapp_askanswer_list as $key => $value) {
$ask_select_html .= "<option value='{$key}'>{$value}</option>";
}
/*end*/
}
mysqli_close($conn);
function tips($msg)
{
die('<script type="text/javascript">alert("'.$msg.'");window.location.href = "setpwd.php";</script>');
}
/**
* 递归删除文件夹
*
* @param string $path 目录路径
* @param boolean $delDir 是否删除空目录
* @return boolean
*/
function delFile($path, $delDir = FALSE) {
if(!is_dir($path))
return FALSE;
$handle = @opendir($path);
if ($handle) {
while (false !== ( $item = readdir($handle) )) {
if ($item != "." && $item != "..")
is_dir("$path/$item") ? delFile("$path/$item", $delDir) : @unlink("$path/$item");
}
closedir($handle);
if ($delDir) {
return @rmdir($path);
}
}else {
if (file_exists($path)) {
return @unlink($path);
} else {
return FALSE;
}
}
}
?>
易优CMS - 修改后台登录密码<br/><br/>
<form action="setpwd.php" method="post">
用户名:
<select name="user_name">
<?php echo $select_html;?>
</select><br/><br/>
新密码:<input type="password" name="password" value=""><br/><br/>
<input type="hidden" name="type" value="1">
<input type="submit" name="submit" value="确认修改">
</form>
<?php if (version_compare($version,'v1.4.2','>')) { ?>
<br/>
<hr/>
<br/>
易优CMS - 修改插件问题与答案<br/><br/>
<form action="setpwd.php" method="post">
新问题:
<select name="ask">
<?php echo $ask_select_html;?>
</select><br/><br/>
新答案:<input type="text" name="answer" value=""><br/><br/>
<input type="hidden" name="type" value="3">
<input type="submit" name="submit" value="确认修改">
</form>
<?php } else { ?>
<br/>
<hr/>
<br/>
易优CMS - 修改插件安装密码<br/><br/>
<form action="setpwd.php" method="post">
新密码:<input type="password" name="password" value=""><br/><br/>
<input type="hidden" name="type" value="2">
<input type="submit" name="submit" value="确认修改">
</form>
<?php } ?>
</body>
</html>
- 请问如何处理升级为香港主机后网站无法访问的问题
- 防火墙设置与云服务器80端口访问限制
- 解决远程登录服务器失败及重启后仍无法连接的问题
- 远程访问故障排除 - 解决无法登录虚拟主机和数据库的问题
- 解析与绑定完成后网站仍无法正常访问的排查步骤及解决方案
- 请问如何在ASP页面中判断客户端浏览器是否为移动设备,并进行相应的跳转?
- 输入网站后台密码时显示不对,如何解决?
- 选择合适工具,掌握静态网站模板修改方法
- 静态网站上传后如何安全有效地进行修改,确保不影响网站的正常运行?
- 请问如何修改网站图片源代码
- 网站admin密码忘记了怎么办
- 如何解决PbootCMS网站后台推送文章到百度时的“site error”错误?
- 迅睿CMS网站用户投稿如何取消验证码
- 宝塔面板提示不是安全连接或私密连接,如何解决?
- 网站提示429 Too Many Requests:用户发送了太多请求怎么办
- 易优cms搜索结果页如何统计关键词文章数量
- 网站源码安装后访问首页,页面错乱的处理方法
- pbootcms模板如何做好防护
- 重置网站后台管理员账号密码
- 升级完后网站提示500错误怎么办
- pbootcms如何设置发布内容不自动提取缩略图(1)
- 百度网址安全中心提醒您:该页面可能存在违法信息!如何处理?
- 易优cms数据表或视图不存在,请联系技术处理。
- Pbootcms留言“提交成功”的提示语修改(1)
- PBOOTCMS中新增并开启手机端模板,以便为用户提供更好的移动设备浏览体验
- imagecreatefrompng(): gd-png: libpng warning: iCCP: known incorrect sRGB profile
- 易优CMS文章内容页如何获取上一篇下一篇
- PbootCMS全站模板date时间标签/时间格式常见的8种调用方式
- pbootcms网站后台登录提示:”登录失败:数据库目录写入权限不足!“
- Nginx 启动/停止 / 首页显示 / 安装 / 卸载