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 Dragos в кодування, 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 та завантажити & відкрити файл РГ-config.php з простий текстовий редактор, наприклад в "Блокнот / 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 . Тепер натисніть кнопку Огляд, щоб побачити рядків, що містяться в таблиці xx_users.

Click on browse

Click on 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. Після того як ви зашифрований пароль, вибрати і скопіювати нову Generated 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. Нарешті, натисніть на кнопку Go, щоб зберегти новий пароль.

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 Newpassword $ = 'NEW_PASSWORD_GOES_HERE' / / покласти новий пароль між поодинокими лапками
	$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 @ Include_once ( '. / WP-config.php'); / / отримати деякі деталі з вашої установки WordPress
	global $table_prefix; Global $ table_prefix;
	$conxb=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD); //establish connection to your database $ Conxb = mysql_connect (db_host, db_user, DB_PASSWORD) / / встановити з'єднання з базою даних
	mysql_select_db(DB_NAME,$conxb); 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'; $ Запит = 'Оновити `'. Table_prefix $. 'Користувачам набір` `user_pass` = \''. Mysql_real_escape_string (md5 ($ Newpassword)).' \ ', Де `user_login` = \''. Mysql_real_escape_string ($ Ім'я користувача). '\' LIMIT 1 ';
	$mQuery=mysql_query($query,$conxb); //set new password $ MQuery = mysql_query ($ запиту, $ conxb); / / встановити новий пароль
	echo $mQuery?'Successfully set new password. Ехо $ mQuery? Успішно встановлений новий пароль. New password: '.$newPassword:'There was an error. Новий пароль: '. $ Newpassword: "Був помилка. Error: '.mysql_error(); //if result is unsuccessful you'll see the mysql error message . Mysql_error Помилка: '(); / / якщо результат невдалого ви побачите повідомлення про помилку MySQL
	mysql_close($conxb); 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). Тепер витягти Zip архів ви тільки що завантажили і змінити необхідні параметри, відповідно до ваших потреб (пояснення коментарів присутніх в коді 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 , Щоб переконатися, що це правильний каталог, шукати файл з ім'ям РГ-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. якщо воно там ви на вірному шляху, інакше подивитися на каталог, в якому РГ-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. Wordpress: Version 2.8.6 is out. Wordpress: версія 2.8.6 виходить. Make sure to update your blog! Переконайтеся в тому, щоб оновлювати свій блог!
  4. PHP Error: Call to a member function fetch_assoc() on a non-object in PHP помилка: Виклик функції-члена FETCH_ASSOC () на не-об'єкт у
  5. PHP: How to get creation time of file with PHP on Linux machines PHP: Як отримати час створення файлу з PHP на комп'ютерах Linux

  • Katya Каті
    :) :)
  • purie purie
    i have to try but why does still there error ? Я повинен спробувати, але чому ж ще там помилка? when i would to login.. коли б я Логін .. cann`t read the password .. Cann `T прочитати пароль ..
    could you tell why does my code still error. Чи могли б ви розповісти, чому мій код все ще помилки. thank you Спасибо
blog comments powered by Disqus Блог коментарі сила Disqus