If your using drupal,

Are you forget your password, doesn't having a mail feature ( What to do...? )

Try this..!




Create a file in root ('/www/' or '/public_html/' or '/htdocs/' or any) with the name whatever you want ( I placed as "password_hasher.php" ).



Copy below code and paste into that file.


<?php
$password = $_REQUEST['pwd']; // you may change it with your required password directly

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/' . variable_get('password_inc' , 'includes/password.inc');drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);header("Content-Type: text/plain; charset=utf-8");
echo "Update this password : " . user_hash_password($password);?>


run the page in web browser, ( I think you all know how run PHP code )

if it is in localhost


http://localhost/drupal/password_haser.php?pwd=newpassword





=> Here drupal is my project name if the file directly in root remove drupal

=> Here "newpassword" is the password I want to set


and run the query in PHPMYADMIN or Mysql




UPDATE users SET pass = 'the code that generated at the top' WHERE uid = 'userid goes here';








=> If user is admin mostly it set as 1

=> Or you give the id of the user

=> Don't forget to place generated hash code in query :P

0 comments:

Post a Comment

 
Top