This is a translated page. The original can be found here: http://iwebdevel.com/2009/06/08/wordpress-easily-reset-your-account-password-using-mysql-and-php/
UPDATES VIA RSS | Email Актуализации по RSS | Email Get updates via feedburner Get updates via twitter
Home / Coding / MySQL / PHP / Wordpress: Easily Reset Your… Начало / кодиране / MySQL / PHP / Wordpress: Лесно Reset Your ...

Wordpress: Easily Reset Your Account Password Using MySQL and PHP Wordpress: Лесно Проучване Вашата Сметка парола Използване на MySQL и PHP

Posted on 08. Публикувано на 08. Jun, 2009 by Dragos in Coding , MySQL , PHP Юни, 2009 от Драгош в кодиране, MySQL, PHP

I've just forgot my admin password on my local testing blog, and what is worse – my local machine is not configured to send external email. Току-що Забравих си администратор парола на местната тестване блог, както и това, което е по-лошо - моята локална машина не е конфигуриран да изпраща външна поща. Oh yeah, got to reinstall wordpress again, what a pity. О, да, трябва да преинсталирате WordPress отново, колко жалко. No way! Няма начин! There are two ways of resetting your password using two easy methods. Има два начина за възстановяване на паролата си използвайки два лесни методи. You'll need basic knowledge of PHP or CPanel+PHPMyAdmin. Ще трябва основни познания по PHP или CPanel + PHPMyAdmin.

I Method: CPanel+PHPMyAdmin Аз Метод: CPanel + PHPMyAdmin

For this method, it is necessary that your host have CPanel and PHPMyAdmin installed. За този метод, е необходимо да си домакиня, която CPanel и PHPMyAdmin инсталиран. If your host doesn't have these pieces of software, but something similar to these, you can follow this tutorial and apply these steps to your situation. Ако вашият домакин не са тези парчета на софтуер, но нещо подобно на тези, можете да следвате този урок и да прилагат тези мерки, за да си положение.

First we'll need to open the PHPMyAdmin page. Първо ще трябва да отворите страницата PHPMyAdmin. From the CPanel root page, launch PHPMyAdmin. От главната страница CPanel, хвърлям PHPMyAdmin. The icon of PHPMyAdmin should look similar to the one emphasized in the screenshot below. Иконата на PHPMyAdmin трябва да изглежда подобно на това подчерта в екрана по-долу.

PHPMyAdmin

PHPMyAdmin PHPMyAdmin

Once on the main page of PHPMyAdmin you should remember what database did you use when installing wordpress. След като на главната страница на PHPMyAdmin, трябва да си спомните какво е база данни, да използвате при инсталиране на WordPress. If you don't remember, don't get angry. Ако не си спомняте, не се ядосвате. Go to your root folder where wordpress is installed and download & open the file wp-config.php with a simple text editor like Notepad/GEdit. Отидете в главната папка, където е инсталиран и WordPress изтегляне & отворите файла WP-config.php с обикновен текстов редактор като Notepad / Gedit. You'll need to find this line: Ще трябва да намерите този ред:

 define('DB_NAME', 'ABCD'); DEFINE ( 'DB_NAME "," ABCD "); 

Note that ABCD (without the single quotes around it) is the name of the database that wordpress is installed in. Имайте предвид, че ABCD (без единични кавички около нея) е името на базата данни, която се инсталира WordPress инча

Back on the PHPMyAdmin page, click on the link of your database name. Обратно на страницата PHPMyAdmin, щракнете върху връзката на името на вашата база данни. In my case it was _iwebdevel . В моя случай това беше _iwebdevel.

Select your database

Select your database Изберете вашата база данни

Now you'll see another PHPMyAdmin page, but this time you'll be presented all your tables contained in the ABCD database. Сега ще видите друга страница, PHPMyAdmin, но този път ще бъдат представени всички таблици, съдържащи се в базата данни ABCD. We need to select the table users . Ние трябва да изберете на масата потребители. You won't see the exact name users of this table, but a name in this format xx_users , where xx_ is the prefix of your wordpress table names. Вие няма да видите точно потребителското си име на тази таблица, но име в този формат xx_users, където xx_ е префикс на вашия WordPress имена таблица. Click on the link of your users table ( xx_users ). Кликнете върху връзката на потребителите си маса (xx_users). In my case, as in most cases it's wp_users : В моя случай, тъй като в повечето случаи това е wp_users:

Select the users table

Select the users table Изберете потребители таблица

Now click on browse to see the rows contained in table xx_users . Сега кликнете върху Browse да видите редове, съдържащи се в таблицата xx_users.

Click on browse

Click on browse Щракнете върху Browse

Now look for the username you want to reset the password. Сега гледам за потребителското име, което искате да смените паролата. In my case I want to reset password for admin. Now click on the edit button. В моя случай, че искате да смените паролата за администратор. Сега кликнете върху бутона "Редактиране".

Edit user's details

Edit user's details Редактиране на потребител подробности

Now you'll need to generate an MD5 hash of the new password you would like to set. Сега ще трябва да генерира MD5 хеш на нова парола бихте искали да зададете. Go to http://seoanalytic.com/tools/md5_encryptor/ and enter your preferred password. Отидете на http://seoanalytic.com/tools/md5_encryptor/ и въведете предпочитания от вас парола. After you enter your new password, click on the Encrypt! button. След като въведете новата си парола, щракнете върху Шифроване! Бутон.

Encrypt your password

Encrypt your password Шифроване на паролата

After you've encrypted your password, select and copy the newly MD5 generated hash code. След като сте криптирана парола, изберете и копиране на генерирани нови MD5 хеш код.

Select and copy the MD5 hash

Select and copy the MD5 hash Изберете и копие на MD5 хеш

Now return to your PHPMyAdmin page and paste your MD5 hash from the clipboard to the input field as shown in the image below: Сега се върнете към страницата PHPMyAdmin и поставите вашия MD5 хеш от клипборда в полето за въвеждане, както е показано на картинката по-долу:

Paste MD5 hash in the specified input field

Paste MD5 hash in the specified input field Постави MD5 хеш, посочени в областта вход

Finally click on Go button to save your new password. Накрая кликнете върху бутона Отидете да спаси новата си парола.

Save new password

Save new password Запази новата парола

II Method: PHP II Метод: PHP

In my opinion the second method is much faster and simpler. По мое мнение на втория метод е много по-бързо и по-лесно. In this method you'll just have to upload a PHP file to your host and access it with a browser. При този метод ще трябва да качите файл PHP да си домакин и достъп до него с браузър. But we'll talk about it a little bit later. Но ние ще говорим за това малко по-късно.

So here's the piece of PHP code I've came up with to help you reset your wordpress account password. Така че тук е част от код PHP аз измислих да ви помогне да възстановите паролата си WordPress.

	$newPassword='NEW_PASSWORD_GOES_HERE'; //put your new password between the single quotes $username='admin'; //put the login username you'd like to change the password to @include_once('./wp-config.php'); //get some details from your wordpress installation global $table_prefix; $conxb=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD); //establish connection to your database mysql_select_db(DB_NAME,$conxb); $query='update `'.$table_prefix.'users` set `user_pass`=\''.mysql_real_escape_string(md5($newPassword)).'\' where `user_login`=\''.mysql_real_escape_string($username).'\' limit 1'; $mQuery=mysql_query($query,$conxb); //set new password echo $mQuery?'Successfully set new password. $ newPassword = 'NEW_PASSWORD_GOES_HERE "; / / сложиш нова парола между единични кавички $ потребителско име =' администратор"; / / постави вход потребителското име, което искате да промените паролата на @ include_once ( '. / WP-config.php '); / / получите някои детайли от WordPress инсталацията глобални $ table_prefix; $ conxb = mysql_connect (DB_HOST, db_user, DB_PASSWORD); / / установи връзка с базата данни mysql_select_db (DB_NAME, $ conxb); $ въпрос =' Обновяване на `" . $ table_prefix. "ползватели" в стаята "user_pass" = \''. mysql_real_escape_string (md5 ($ newPassword)). "\", където "user_login" = \''. mysql_real_escape_string ($ потребителско име). '\' LIMIT 1 "; $ mQuery = mysql_query ($ заявка, $ conxb); / / задаване на нова парола ехо $ mQuery? "Успешно определени нова парола. New password: '.$newPassword:'There was an error. Нова парола: ". $ NewPassword:" Имаше грешка. Error: '.mysql_error(); //if result is unsuccessful you'll see the mysql error message mysql_close($conxb); Грешка: ". Mysql_error (); / / ако резултатът е неуспешен, ще видите съобщение за грешка, MySQL mysql_close ($ conxb); 

For your convenience you can download the file reset.php from here . За ваше удобство можете да изтеглите reset.php файл от тук.

Now extract the zip archive you've just downloaded and edit the necessary parameters to suit your needs (explanation comments are present in the PHP code above). Сега екстракт на пощенски архив току-що сте изтеглили и редактиране на необходимите параметри, за да отговарят на вашите нужди (обяснение коментари се намират в PHP кода по-горе). Then upload the file reset.php to your wordpress root installation folder. Тогава качите файла reset.php на WordPress папката корен инсталация. To make sure that this is the right directory, look for a file named wp-config.php , За да сте сигурни, че това е правилният директория, потърсете файл с име "WP-config.php, if it's there you're on the right way, else look for the directory where wp-config.php is present and upload the file reset.php there. ако той е там сте на прав път, иначе гледам за директорията, където WP-config.php присъства и качване на файл reset.php там.

Finally you'll want to go to http://yourDomainName.TLD/ reset.php . Най-накрая ще искате да отидете на http://yourDomainName.TLD/ reset.php. You'll see the appropriate message depending on how the script worked. Ще видите съобщение подходящи в зависимост от това как работи скрипта. If there is an error, post it here and I'll try to help you, else you did everything perfectly and you can now log in with your new password. Ако има грешка, след това тук и аз ще се опитам да ви помогна, иначе ти е всичко перфектно и вече можете да влизате с новата си парола.

Translate this post Превод този пост





Related posts: Свързани пунктове:

  1. Wordpress 2.8.4: Not ready to be installed with PHP 5.3 ? Wordpress 2.8.4: Не е готова да се инсталира с PHP 5.3?
  2. Wordpress: Best SEO iTranslator for Wordpress, get free traffic from fully automated plugin script Wordpress: Най-добър SEO iTranslator за Wordpress, получите безплатен трафик от напълно автоматизиран скрипт плъгин
  3. PHP Error: Call to a member function fetch_assoc() on a non-object in PHP Error: Покана към член функция fetch_assoc () на недискриминационна основа обект в
  4. PHP: How to get creation time of file with PHP on Linux machines PHP: Как да се създаването време на файл с PHP върху машини Linux
  5. Coding:How to fetch user profile data with SSI.php from a SMF forum database Кодиране: Как да донесе данни с потребителски профил SSI.php от база данни SMF форум

    blog comments powered by Disqus Блог коментари захранва от Disqus