跳转到主要内容
mahonghong 提交于 22 April 2015

解决方法来自:

https://www.drupal.org/node/1556488

创建一个PHP文件,把下面的代码复制进去:

<?php define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); require_once DRUPAL_ROOT . '/includes/password.inc'; if (isset($_GET['pass']) && !empty($_GET['pass'])) {   $newhash =  user_hash_password($_GET['pass']); } else {   die('Retry with ?pass=PASSWORD set in the URL'); }

$updatepass = db_update('users')   ->fields(array(     'pass' => $newhash, // Uncomment the following lines to reset the administrative username and/or email address, if necessary. //    'name' => 'admin', //    'mail' => 'yourmail@example.com'   ))   ->condition('uid', '1', '=')   ->execute(); print "Done. Please delete this file immediately!"; drupal_exit(); ?>

上传至drupal根目录, 然后按照下面的方式访问这个PHP文件

http://example.com/文件名.php?pass=新密码

这样即可更改成功,前提是你要找回的账号是1号账号.

 

Drupal 版本