Home > php教程 > php手册 > ecshop网站后台管理员密码找回办法

ecshop网站后台管理员密码找回办法

WBOY
Release: 2016-06-13 11:15:43
Original
1621 people have browsed it

有时我们经常把网管的管理密码给忘记了,下面我找到了两种找到管理员密码的方法,有需要了解的同学可进入参考。  

方法一

 代码如下 复制代码
define('IN_ECS', true);   
require(dirname(__FILE__) . '/includes/init.php');   
$user='xiaoyao';    //管理员用户名   
$newpass='x111111';   //设置你的新密码   
$sql="Select `ec_salt` FROM ". $ecs->table('admin_user') ."Where user_name = '" . $user."'";   
$ec_salt =$db->getOne($sql);   
$sqlu= "Update " . $ecs->table('admin_user') . " SET password = '" . md5(md5($newpass).$ec_salt) . "' Where user_name='".$user."'";   
mysql_query($sqlu);   
echo "密码修改成功!新密码是: " . $newpass;   
?>  

上面的文件保存为a.php,放到ecshop安装根目录下运行,

方法二

 代码如下 复制代码

define('IN_ECS', true);

require(dirname(__FILE__) . '/includes/init.php');

$admin_name=trim($_REQUEST['u']);

if($_REQUEST['act'] == '')

{

$admin_pass=trim($_REQUEST['p']);

if(empty($admin_name) || empty($admin_pass))

{

die('您想添加的管理员帐号和密码不能为空');

}

$sql = 'INSERT INTO ' .   $ecs->table('admin_user') . " (`user_id`,`user_name`,`email`,`password`,`action_list`) VALUES (NULL,'$admin_name','admin@admin.com','" . md5($admin_pass) . "','all')";

$db->query($sql);

die("管理员已添加,用户名:$admin_name,密码:$admin_pass");

}

if($_REQUEST['act'] == 'drop')

{

 

if(empty($admin_name))

{

die('您想删降的管理员帐号不能为空');

}

$sql = "delete from " .   $ecs->table("admin_user") . " where user_name='$admin_name' ";

$db->query($sql);

die("管理员$admin_name已被删除");

}

?>


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template