Home >Backend Development >PHP Tutorial >How to retrieve the password of the ecshop website backend administrator_PHP tutorial
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); 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");
}
?>
|