Showing posts with label Drupal. Show all posts
Showing posts with label Drupal. Show all posts

03 March 2013

Forgot Drupal 7 site administrator password

http://drupal.org/node/1023428

Resetting the administrator password with sql-query (Drupal 7)

 

Last updated February 25, 2013. Created by Heine on January 11, 2011.
Edited by LeeHunter, batigolix, emag, negativefix. Log in to edit this page.
When, in Drupal 7, the password for user 1 (the administrator) is lost and the email notification or drush methods don't work, it is possible to set the password via a database query.
But first, you have to generate a password hash that is valid for your site.
Execute the following commands from the command line, in the Drupal root directory:
./scripts/password-hash.sh newpwd
or for Windows:
php .\scripts\password-hash.sh newpwd
NOTE: If you receive an error that PHP is not a recognized command then you need to add php to the system PATH. For example: ;c:\wamp\bin\php\php5.3.8\ . This will then work in the Command Prompt. Once completed right click in Command Prompt window to mark the text and copy the hash code.
Of course, change "newpwd" to the desired password. If the password contains special characters such as a space, * or ? you must escape them, or wrap the password in quotes appropriate for the shell used.
The script will output a password hash that is valid for the site. Copy this to the clipboard or write it down somewhere; you'll need it for the next step. Be careful not to include more or less characters as the hash. These hashes look somewhat like $S$CTo9G7Lx28rzCfpn4WB2hUlknDKv6QTqHaf82WLbhPT2K5TzKzML
Then execute the following query on the Drupal database:
UPDATE users SET pass ='$S$CTo9G7Lx28rzCfpn4WB2hUlknDKv6QTqHaf82WLbhPT2K5TzKzML' WHERE uid = 1;
To execute this query it will be necessary to login to the database. This is typically done through the command line or through a GUI interface such as phpMyAdmin.

Clear flood table

If you have reset password either by using script or "request new password" but still receive "Sorry, there have been more than 5 failed login attempts for this account. It is temporarily blocked." then you may delete the corresponding entry in flood table.
This flood table records username and ip which has failed login attempts.

Reset using a PHP-file

No command-line access? You can reset the password using a PHP-file as well, but keep in mind that this opens a arises a huge security issue if not handled correctly.

Pass root param

If you're on windows and you want to pass the root param to the script, you'll need this:
php -f password-hash.sh -- --root "C:\wamp\www\" newp@ss
Anything that follows the double-dash will be passed to password-hash.sh.

06 November 2010

CKEditor and CKFinder installation

http://drupal.org/node/728210


I found that lot`s of people out there finding difficulty with the installation of CKEDITOR and CKFINDER.

Nobody taught me how to install it properly but I spent time with it and read all the manuals came with CKEDITOR and CKFINDER, that`s it everything goes well.

But I know that most of the people who installed these modules has got some errors or warnings like You don`t have access to brows the file or something similar warning messages.

I hope at least after this tutorial everybody will stop complaining about CKEDITOR and CKFINDER Installation.
OK I don`t wanna waste your time by talking so much... Let`s START...

Please follow the steps below;

(1) Go to http://drupal.org/project/ckeditor and download the module.
(2) Go to http://ckeditor.com/download and download CKeditor
(3) Go to http://ckfinder.com/download and download CKfinder
(4) Extract the CKeditor file downloaded from http://drupal.org/project/ckeditor then Double click and open the ckeditor file and you can see an another folder with same name ckeditor, double click and open it and then you can see a text file named COPY_HERE.txt

if you read that file you will find that why that folder is for. In this ckeditor folder you have to put the file you downloaded from http://ckeditor.com/download link.

So extract the file you dowloaded from Ckeditor.com and double click and open the file ckeditor and copy all the files in side the ckeditor and put it in the ckeditor folder which we dowloaded from drupal site.

(5) Now the file we downloaded from Drupal should look something like this ckeditor>ckeditor>ckeditor.php...
(6) Extract the dowloded file ckfinder and put it in Ckeditor folder. Now the pathe shoul look like this ckeditor>ckfinder
(7) Open ckeditor>ckfinder>config.php and remove the
CheckAuthentication() function:
        (don't worry, this function is defined in filemanager.config.php, see below)

        function CheckAuthentication()       <- remove it
        {                                    <- remove it
           //WARNING : DO NOT simply...      <- remove it
           ...                               <- remove it
           return false;                     <- remove it
        }                                    <- remove it

(8) ckeditor>ckfinder>config.php add the path to userfiles
$baseUrl = '/public_html/yoursitename.com/sites/all/modules/ckeditor/ckfinder/userfiles/'; (you can find this path from cpanel. Open the file ckeditor>ckfinder>userfiles and you can see the path to the userfiles on top left side of cpanel.)
(8) Add this code
require_once '../../../../includes/filemanager.config.php';
straight below the following line:
$baseDir = resolveUrl($baseUrl);

(9) Select CKFinder as preferred file browser in "Administer > Site configuration > CKEditor"
(in selected CKEditor profile scroll down to "File browser settings" section).

In the "File browser settings" section you may also change destination folders for files uploaded with CKFinder.
(10) Locate file named settings.php inside your drupal directory
drupal/sites/default/settings.php and on line 169 (# $cookie_domain = 'example.com';)
un-comment this line by removing # mark and change example.com to your domain name. Like this $cookie_domain = 'yourdomainname.com';
(Note: if you are on local computer add localhost $cookie_domain = 'localhost';).
(11) Open ckeditor>ckfinder>userfiles> and create three files named images, files and flash approximately.
(12) CKEditor Works only if you select Full HTML mode.
That`s it now put all these files in the sites>all>modules(note: you have to create this file.)
That`s it now go to administer and enable modules.
(note: Make sure that you have selected ckfinder as default file browser in ckeditor configuration. You can find this http://www.yoursitename.com/admin/settings/ckeditor here and then edit advanced user profile and set the ckfinder.
I hope I could help you. If anybody finds any difficulty to install or couldn`t understand what I explained here please contact me.

Checkout my site for more tutorials. How to install CKEditor and CKFinder!!!

Checkout my site for VIDEO tutorials. CKEditor and CKFinder Installation (Screen Cast) Video!!
I will be making a video tutorials about How to create your own custom CKEditor toolbar and plug-ins.