Reset Joomla Super Admin Password Remotely

This form will simplify the process of resetting a Joomla Super User password. When the file is run, it will connect to the Joomla database using the instructions it detects in the configuration.php file, then gather and display the usernames and emails of Super Users found in the _users table. Simply select the user and enter a password, then click the reset button.

 

Stuff to note

  • This form is not a Joomla extension so do not try to install it.
  • It will not create a user.
  • It will not delete a user.
  • It will only change the password of Joomla Super User.

Usage

  • Upload the single php file named userreset.php to the root of the Joomla installation, where configuration.php is located.
  • Run the file using the browser by entering the website URL eg: yourdomain.com/userreset.php
  • Select the username from the option select field.
  • Enter the password to reset
  • Delete the file from your host after use.

 

 

joomla super user password reset yool

 

What's in the file

The PHP

$con='';
if( file_exists(dirname(__FILE__).'/configuration.php') ) {
include 'configuration.php';
$con = new JConfig;

	$usertbl = $con->dbprefix.'users';
	$usergrp = $con->dbprefix.'user_usergroup_map';
	
	if( isset($_POST['username']) ) $username = '"'.$_POST['username'].'"';
	if( isset($_POST['password']) ) $password = '"'.MD5($_POST['password']).'"';

	$dbconnect = new mysqli($con->host, $con->user, $con->password, $con->db);
	
	$query = "UPDATE $usertbl SET password = $password WHERE username = $username";
	$users = "SELECT username, email FROM $usertbl LEFT JOIN $usergrp ON $usertbl.id = $usergrp.user_id WHERE group_id = 8";
	
	$res = $dbconnect->query($users);
	if( $res->num_rows > 0 ) {
		while($row = $res->fetch_assoc()) {
			$usr .= '<ul><li>'.$row['username'].'</li><li>'.$row['email'].'</li></ul>';
			$optname .= '<option value="'.$row['username'].'">'.$row['username'].'</option>';
			$opteml .= '<option value="'.$row['email'].'">'.$row['email'].'</option>';
		}
	}
	

	if( $dbconnect->connect_error ) {
		echo '<p style="color:red">DB connection failed: ('.$dbconnect->connect_errno.') '.$dbconnect->connect_error.'<br>The database username and/or password may be incorrect</p>';
		exit();
	}
	if( isset($_POST['username']) ) {
		if( $dbconnect->query($query) === TRUE ) {
			$result = '<p class="success">The connection was successful and the Query ran, however you should try the login to confirm that the change was made.</p>';
		}
	}

}

The HTML

<!DOCTYPE html>
<html>
<head>
<title>Reset</title>
<style>
body {font-family: verdana; font-size: 13px; padding: 0 50px 50px;}
a {text-decoration: none; color: #b22525; font-weight: 900;}
input, select {display: block; border: 1px solid #bbbbbb; padding: 4px; margin-bottom: 5px;}
.notice {background: #ddf7ff; padding: 8px;}
.notice-alert {background: #ffdde1; padding: 8px; font-size: 28px; text-align: center; color: #ce0100; font-weight: 900;}
.success {background: #f1ffdb; padding: 8px;}
input[type="submit"] {cursor: pointer;}
.footnote {text-align: center; background: #f2f2f2; padding: 5px;}
.list {margin: 20px 0;}
.list ul {list-style: none; padding: 0; margin: 0; overflow: hidden;}
.list li {float: left; padding: 5px; border: 1px solid #eeeeee; width: 50%; box-sizing: border-box;}
.list .th {background: #dddddd; font-weight: 900;}
</style>

</head>

<body>
<?php if( !file_exists(dirname(__FILE__).'/configuration.php') ) 
	echo '<p class="notice-alert">The file is not in the Joomla root directory.<br>It must be in the same directory where the configuration.php file is located.</p>'; 
if( !empty($dbconnect->stat) ) echo '<b>database connection OK</b>';
?>
<form action="" method="post">
<p class="notice">The purpose of this tool is to <b>reset the uername and password for a Joomla Super user</b></p>

<p class="notice-alert">It is absolutely important that you delete this file after use</p>

<?php echo $result; ?>

<div class="list">
<h4>List of Super Users Found In Database</h4>
<ul class="th"><li>Username</li><li>Email</li></ul>
<?php echo $usr; ?>
</div>

<hr />
<h3>Username and Password reset</h3>

Username*<br /><small>Select the user name</small> 
<select name="username" required="required">
<option value="">Select</option>
<?php echo $optname; ?>
</select>
New Password* <input type="text" name="password" size="40" value="" required="required" />
<input type="submit" value="Reset User Login Details" />

</form>
<p class="footnote"><a href="http://websitedons.com">WebsiteDons.com</a></p>
</body>
</html>

Sunday, 11 September 2016 03:15  |   554 views

 

Copyright © 2018 CMSEnergizer.com. All Rights Reserved.
This website is powered by the Joomla!©™ 3 Website Framework | File download and article manager component by K2 | Advanced Module Manager and Modules Anywhere by NoNumber Elements | Website hosting and development by WebsiteDons

CMSEnergizer.com is owned and operated by Emuzement Net Inc, 4532 West Kennedy Blvd. Ste 180 33609 Tampa, Florida USA