Home >Backend Development >PHP Tutorial >How to retrieve the password of the ecshop website backend administrator_PHP tutorial

How to retrieve the password of the ecshop website backend administrator_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 10:59:24841browse

Sometimes we often forget the management password of the network management system. Below I have found two methods to find the administrator password. Students who need to know more can refer to it. ​

Method 1

 代码如下 复制代码
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;   
?>  

Save the above file as a.php, put it in the ecshop installation root directory and run it,

Method 2

The code is as follows Copy code
 代码如下 复制代码

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已被删除");

}

?>


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('The administrator account and password you want to add cannot be empty');
}
$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("Administrator has been added, username: $admin_name, password: $admin_pass"); } if($_REQUEST['act'] == 'drop') { if(empty($admin_name)) { die('The administrator account you want to delete cannot be empty'); } $sql = "delete from " . $ecs->table("admin_user") . " where user_name='$admin_name' "; $db->query($sql); die("Administrator $admin_name has been deleted"); } ?>
http://www.bkjia.com/PHPjc/445613.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445613.htmlTechArticleSometimes we often forget the management password of the network administrator. Below I found two methods to find the administrator password. , students who need to know more can enter for reference. Method 1 The code is as follows...
Statement:
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