ecshop网站后台管理员密码找回办法
有时我们经常把网站的管理密码给忘记了,下面我找到了两种找到管理员密码的方法,有需要了解的同学可进入参考.
方法一,代码如下:
- <?php
- 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安装根目录下运行.
方法二,代码如下:
- <?php
-
- define('IN_ECS', true);
-
- require(dirname(__FILE__) . '/includes/init.php');
-
- $admin_name=trim($_REQUEST['u']);
-
- if($_REQUEST['act'] == '')
-
- {
-
- $admin_pass=trim($_REQUEST['p']);
-
- if(emptyempty($admin_name) || emptyempty($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(emptyempty($admin_name))
-
- {
-
- die('您想删降的管理员帐号不能为空');
-
- }
-
- $sql = "delete from " . $ecs->table("admin_user") . " where user_name='$admin_name' ";
-
- $db->query($sql);
-
- die("管理员$admin_name已被删除");
-
- }
-
- ?>