How to reset your Joomla admin password using a custom PHP script

We will create a PHP script to reset our admin password in Joomla.

Using a text editor enter the code exactly as illustrated here

The value entered for the variable $password (password1234) will be the new password for your admin user account

1) Now select the Save menu option. Give the file a name like ‘resetadmin.php’ and then upload it to your Joomla web site root or home directory.  Run the script by entering http://www.yourdomain.com/resetadmin.php from your browser

2) Now log in to your admin panel using the password you entered in the previously written script

3) Enter your User Name

4) Next enter the password from your script

5) Now click the Log in button

6) After logging in, select the User Manager icon.

7) Click the name of the account you just reset the password for

How to reset your Joomla admin password using a custom PHP script

How to reset your Joomla admin password using a custom PHP script

8) Here you can change the password and Save the record to update linked tables properly

9) Reenter your password in the Confirm Password field

10) Click the Save & Close button

CODE:

<?php

$username = “admin”;

$password =”password12345″;

require “configuration.php”;

$conf = new JConfig();

$dblink = mysql_connect($conf->host, $conf->user, $conf->password);

mysql_query(“USE $conf->db”);

mysql_query(“UPDATE ($conf->dbprefix)users SET password = MD5(“$password”) WHERE username = ‘$username'”);

mysql_close($dblink);

?>

You now know how to reset your Joomla admin password using a custom PHP script

Be Sociable, Share!

Leave a comment