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: สะดวกใหม่ของคุณ ...

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 มิ.ย., 2,009 โดย 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 I วิธี: 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'); กำหนด ( '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. หลังจากที่คุณได้เข้ารหัสรหัสผ่านของคุณเลือกและคัดลอกใหม่ 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; ทั่วโลก $ 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'; $ สอบถาม = 'update `'. $ table_prefix. 'ผู้ใช้` ตั้ง user_pass `` = \''mysql_real_escape_string. (md5 ($ newPassword)).' \ 'ซึ่ง `user_login` = \''. mysql_real_escape_string ($ username). '\' 1 จำกัด ';
	$mQuery=mysql_query($query,$conxb); //set new password $ mQuery mysql_query = (conxb $ ค้นหา, $) / / ตั้งรหัสผ่านใหม่
	echo $mQuery?'Successfully set new password. echo $ 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). ตอนนี้แยกเก็บไปรษณีย์ที่คุณได้ดาวน์โหลดเพียงและแก้ไขพารามิเตอร์ที่จำเป็นเพื่อตอบสนองความต้องการของคุณ (ความคิดเห็นที่นำเสนอคำอธิบายในโค้ด 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: iTranslator SEO ที่ดีที่สุดสำหรับ Wordpress รับการเข้าชมฟรีจากสคริปต์ปลั๊กอินอัตโนมัติอย่างเต็มที่
  3. Wordpress: Version 2.8.6 is out. Wordpress: เวอร์ชัน 2.8.6 มี out. 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 Katya
    :) :)
  • purie purie
    i have to try but why does still there error ? ฉันได้ลองแต่ทำไมยังมีข้อผิดพลาด? when i would to login.. เมื่อ i เพื่อจะเข้าสู่ระบบ .. cann`t read the password .. cann `t อ่านรหัสผ่าน ..
    could you tell why does my code still error. คุณอาจจะบอกรหัสของฉันทำไมยังผิดพลาด. thank you ขอบคุณ
blog comments powered by Disqus บล็อกความคิดเห็นขับเคลื่อนโดย Disqus