Drupal 登录提示Unrecognized Username and Password. 【已解决】
2016-05-19 03:34
447 查看
使用 Drupal 进行建站,使用admin登录,在logout 之后再想登录就会出现 Unrecognized Username and Password. 但是查询数据库的users表发现,admin账号还在所以可以确定admin的密码可能出现了问题。 因为密码使用hash进行了加密,所以我们不能直接对数据库中的密码列进行修改,但是我发现了另外一种解决办法。方法如下。
1. 找到 drupal的根路径,在根路径下会有一个index.php
2. 打开并修改该 index.php. 修改内容如下;保存。
<?php
/**
* @file
* The PHP page that serves all page requests on a Drupal installation.
*
* The routines here dispatch control to the appropriate handler, which then
* prints the appropriate page.
*
* All Drupal code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt.
*/
/**
* Root directory of Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());
require_once 'includes/password.inc';
echo user_hash_password('yournewpassword'); die();
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();
3. 在游览器中打开该index.php.
在游览器中打开该php文件时你会发现一个只显示一行乱码的网页,这行乱码就是你的新密码加密过之后的结果。
4. 复制这行乱码,打开数据库,替换掉你想要更新密码的账户的密码。
5. Done!
1. 找到 drupal的根路径,在根路径下会有一个index.php
2. 打开并修改该 index.php. 修改内容如下;保存。
<?php
/**
* @file
* The PHP page that serves all page requests on a Drupal installation.
*
* The routines here dispatch control to the appropriate handler, which then
* prints the appropriate page.
*
* All Drupal code is released under the GNU General Public License.
* See COPYRIGHT.txt and LICENSE.txt.
*/
/**
* Root directory of Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());
require_once 'includes/password.inc';
echo user_hash_password('yournewpassword'); die();
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();
3. 在游览器中打开该index.php.
在游览器中打开该php文件时你会发现一个只显示一行乱码的网页,这行乱码就是你的新密码加密过之后的结果。
4. 复制这行乱码,打开数据库,替换掉你想要更新密码的账户的密码。
5. Done!
相关文章推荐
- 贝叶斯推断--Gibbs Sampling
- LeetCode 5. Longest Palindromic Substring(最长回文子串)
- lua-洗牌算法
- html5无法获取页面的输入值
- 燃尽图
- 在Pythonanywhere上部署Django
- python 的import机制2
- YAML初探
- NYOJ-19-擅长排列的小明
- Xsolla 有15项新功能添加到了4月份的日志中。
- 关于 Java连接sql的转载
- SQL Server删除重复行
- [Ruby笔记]6. Ruby load require 使用对比
- PTA Review of Programming Contest Rules
- 万能的sdk工具!
- Spring 事务机制详解
- JSP+JavaScript实现图片切换
- 百度地图SDK-BaseMapDemo
- 知识工作是熬心血的工作,编程开发更是
- C#实现百度地图附近搜索&调用JavaScript函数