Skip to content

Instantly share code, notes, and snippets.

@init90
Created December 20, 2013 20:43
Show Gist options
  • Save init90/b7ed6dee23fd2232e56c to your computer and use it in GitHub Desktop.
Save init90/b7ed6dee23fd2232e56c to your computer and use it in GitHub Desktop.
Відновлення паролю в drupal 7 Додати в корінь сайту з назвою наприклад pass.php, тоді виконати його так site.name/?pass='new_pass'
<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
$admin = user_load(1);
$pass = isset($_GET['pass'])? trim($_GET['pass']): 'pass';
$uid = isset($_GET['uid'])? trim($_GET['uid']): 1;
user_save($admin, array('pass' => $pass));
$account = user_load($uid);
if(user_check_password($pass, $account)){
echo "[OK]";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment