Recovering or Creating Joomla Administrator Account Password

Posted on September 29, 2009
Filed Under Code Snippets, Joomla CMS | Leave a Comment

I wrote a post about recovering your OpenRealty admin access permissions after having encountered a unique situation in trying to recover admin access to a project demo site. With a little foresight after scripting the version for OpenRealty, I thought that maybe a similar script to help people in the event of a Joomla password mishap would be worthy of creating to. So, I figured I’d put together this little snippet you can add to your snippet inventory just in case. Why would you need something like this? I’ll explain.

If you didn’t read the post regarding the similar OpenRealty script then this will help explain why something like this may be necessary. There are times people may install Joomla and then not use it for a period of time. Over time memory can fade and recovering your password using the normal process isn’t really an option because the email assigned to the account is no longer accessible. To make matters worse, there are actually hosting accounts that specialize in bulk hosting of Joomla or WordPress type sites that really don’t grant access to things like phpMyAdmin. What do you do? You use the script below to generate a temporary Super Administrators Account in order for you to reset or change your former account then you delete the file along with the temporary Super Administrators Account. Simply upload the script to your Joomla directory, navigate to it, and your done. It will create a super admin account called THEADMIN with the password of “password”. Its important to note that I set the number in the 9000 range because if you are not sure how many members you have this number is big enough to ensure you wont likely encounter an error. However, this number is so high that each and every new account created will follow this number so its something to consider changing if you want to keep the user ID lower.

But you might ask, why bother with creating a new account when we could simply reset the account to password? Well the very small script at the very bottom of this post will do just that providing the admin account hasn’t been renamed. Upload and access it the same way you would if you were creating the new account. Enjoy!

This one resets the existing super administrators account password to “password”

[snippet missing]

This one creates a new account and password.

<?php
/*
@ Copyright: (c)2007 - 2009 Jared Ritchey Design, All Rights Reserved.
@ Author URL: http://www.jaredritchey.com
@ Author Email: jared@jaredritchey.com
@ License: GNU/GPL Extended.
@ Config Notes: not knowing how many members are in your DB this has been set to create the account in the 9000 range.
*/

//////////////////////////////////////////////////////////////////////////////////////
// THIS SCRIPT IS USED TO CREATE AN ACCOUNT FOR THEADMIN WITH THE PASSWORD OF password
//////////////////////////////////////////////////////////////////////////////////////
require_once('configuration.php');
$link = mysql_connect($mosConfig_host, $mosConfig_user, $mosConfig_password) or die("Could not connect : " . mysql_error());
mysql_select_db($mosConfig_db) or die("Could not select database");
echo "Database Host: " .$mosConfig_host."<br />";
echo "Database User: " .$mosConfig_user."<br />";
echo "Database Password: " .$mosConfig_password."<br />";
echo "Database: " .$mosConfig_db."<br />";

$sql= "INSERT INTO jos_core_acl_aro VALUES(9001, 'users', '9491', 0, 'THEADMIN', 0)";
mysql_query($sql);

$sql= "INSERT INTO jos_core_acl_groups_aro_map VALUES(25, '', 9001)";
mysql_query($sql);

$sql= "INSERT INTO jos_users VALUES(9491, 'THEADMIN', 'THEADMIN', 'someone@somewhere.com', '7d83778ac1e89412de7bad3e3470dc21', 'Super Administrator', 0, 0, 25, '2007-03-06 11:55:23', '2009-08-11 15:32:15', '', 'editor=fckeditor\nexpired=\nexpired_time=')";
mysql_query($sql);

//echo "<br /><br />";
die("Your SUPER ADMINISTRATOR Account was added - be sure to make modifications prior to continuing and delete this file.");
?>

Hide Null or Empty Value Fields

Posted on September 29, 2009
Filed Under Code Snippets | 1 Comment

Hiding Search Forms Fields with Null Values from the Search String.

Have you ever wanted to reduce that long confusing looking and un-necessary search string in your “GET” type forms? In our line of work we may opt to use one of three primary tools in our projects; OpenRealty, UltimateIDX, or our home grown product we use on high end projects. Regardless of product, in each instance the search forms for the MLS Quick Search uses the form action type of “GET” and in doing so it passes the form value to the URL string for the query. But what happens when you have a null value or a field with NO value? Why bother to pass fields to your search string that have no value? Over time we noted that lengthy search strings regardless of empty values or not would reduce the response time for the results substantially when compared to shorter search strings.

This script was written to help in the reduction of processing burdens placed on servers for large search forms that use the GET method for form processing. It was designed in part to reduce the SQL search timeout issue common in Real Estate MLS Search forms that rely on the “GET” method to reduce the number of fields passed in the query string. If a search form field contains a NULL or no value it will not be passed on to the GET string.

With help from coder / blogger Greg Burghardt of Fundamental Disaster we hashed out this little snippet to achieve what we were after. The code has since been modified and has about 4 different variants in use but this one is the most true to the original.

You can download the snippet in a zip file from right here; SearchForms.zip

To use this script you should add a little php to display a variable in the body tag or you can simply permanently alter the body tag as follows;
EXAMPLE:
<body onload=”enableEmptyFields(document.something);”>

You must also add an onSubmit event handler (property) belonging to a Form object as follows:
EXAMPLE:
<form action=”the-name-of-your-script.php” method=”get” onsubmit=”disableEmptyFields(this);” name=”something”>

/* ############################### COPYRIGHT NOTICE BEGINS #############################
@ Copyright 2008 - 2009: WP Realty Team - Chad Broussard and Jared Ritchey
@ Copyright 2008: Greg Burghardt
@ Copyright URL: http://www.wprealty.org and http://fundamentaldisaster.blogspot.com/
@ Published by: Chad Broussard and Jared Ritchey
@ Scripting: In part by http://fundamentaldisaster.blogspot.com/ and Jared Ritchey Design
@ License: GNU / GPL
@ File Name: searchforms.js
############################### COPYRIGHT NOTICE ENDS ############################# */
/*
@ DISCLAIMER AND USAGE AND LICENSE:
You are free to use this script for whatever reason you so desire providing you leave the copyright details above in
tact as required and you do not redistribute this code rebranded as your own work. You are free to include this
code in any commercial or non-commercial application without further permission or obligation from WPRealty or
Chad Broussard. You may NOT republish this code absent of this copyright notice. LICENSED AS GNU/GPL Open Source
with provisions.
*/

function enableEmptyFields(form) {
  var i = 0;
  var field;
  var j = 0;
  var opt;
  while (field = form.elements[i++]) {
    switch (field.nodeName) {
      case "input":
        switch (field.type) {
          case "checkbox":
          case "radio":
            field.disabled = !field.checked;
            break;
          default:
            field.disabled = false;
            break;
        }
        break;
      case "select":
        if (field.multiple) {
          j = 0;
          while (opt = field.options[j++]) {
            opt.disabled = !opt.selected;
          }
        } else {
          field.disabled = false;
        }
        break;
      default:
        field.disabled = false;
        break;
    }
  }
}
function disableEmptyFields(form) {
  var i = 0;
  var field;
  var j = 0;
  var opt;

  while (field = form.elements[i++]) {
    switch (field.nodeName) {
      case "input":
        switch (field.type) {
          case "checkbox":
          case "radio":
            field.disabled = !field.checked;
            break;
          default:
            field.disabled = (field.value.length > 0) ? false : true;
            break;
        }
        break;
      case "select":
        if (field.multiple) {
          j = 0;
          while (opt = field.options[j++]) {
            opt.disabled = !opt.selected;
          }
        } else {
          field.disabled = (field.value.length > 0) ? false : true;
        }
        break;
      default:
        field.disabled = (field.value.length > 0) ? false : true;
        break;
    }
  }
}

Viewing your site before it goes live – Flush DNS

Posted on February 27, 2008
Filed Under Code Snippets, Technical Resources | 9 Comments

How to Flush DNS – See New Site Before It Resolves Live!

One of the greatest techniques ever used by responsible web designers.

I was chatting with Mack McMillan of UltimateIDX the other day when we got onto discussing the subject we frequently encounter with clients.  Many times clients want to see their blogs and websites prior to them going live and many times that isn’t easily done without some clever techniques I’ll reveal herein.  After having encountered this many times I realized that I should come up with a small guide on "how to build and view a site development prior to it going live"  when I came up with a little tool to distribute in order to help. So this post is generically in response to a common question being asked in forums.   Read more

Now Hiring PHP Coders

Posted on February 17, 2008
Filed Under Code Snippets, Design | Leave a Comment

Seeking PHP / MySQL Coder

Are you a good PHP coder who can code snippets quickly?  I’m looking to hire another PHP coder to help with some small customization and snippets for projects we are working on.  I’m taking all my years of code that we have held for commercial projects and converting them for FREE resources in my new resource directory.  I’d like a person to be well versed in PHP 4+ and although 5+ is the current thing its not the supported thing universally so I need someone who is conscious of that.  I’d like the coder to also be well versed in code sanitation to prevent potential security issues in these old snippets once updated.

The criteria for the coder is as follows;

  1. Commit to a 25 projects minimum and charge accordingly.
  2. Have a valid phone number in either the US, UK, or Canada preferably but not required.
  3. Can be paid by certified funds or a verified PayPal account.
  4. Must use my RTDS (Rapid Template Design Series) coding guideline.
  5. Should understand AJAX and certainly databases.
  6. Should understand XML at least from a dynamic generation perspective.
  7. Must code cleanly with well commented code.
  8. Dont Steal other peoples code. 
  9. Must be at least casually familiar with a few open source applications and have a good understanding of string replace type template engines.

Please contact me using this sites contact form and in your contact please include a phone number and the times of day or week you can work.  Please be fair and competitive in pricing.

Real Estate Webmasters – New Resource Index

Posted on January 30, 2008
Filed Under Code Snippets | 2 Comments

Real Estate Webmaster Resources

After doing a substantial amount of changes to my 4 main blogs over the weekend I came to discover in my directories that I had about 40 important and very usable code snippets that would be truly beneficial for those who are in the development of Real Estate Websites.

I’ve setup a nice little snippet section on one of my sites and then proceeded to take my licensed copy of Code Warehouse 2007 code snippet application and basically create a web based interface that features many of its features in an attempt to make the new section truly easy to manage code snippets and to provide them in a way that is familiar to those that use code manager applications.

I first started out with Open Realty being the base platform for the design of the online snippet DB only to switch to an old modified version of Joomla where I core hacked the menu section to emulate a desktop application familiar to many Windows applications especially to such snippet managers.

Code Resources for Webmasters IDX / RETS and vieleRETS

Over the years I’ve accumulated literally gigabytes of code that have been either modified, abandoned, semi-discarded and half organized only to just take up and waste space.  A great deal of it is salvageable and over the course of several months I was able to scape enough bits and pieces of time to assemble all of these code elements into my code snippet database.  That’s the good part. The frustrating part is that I can’t share it easily with coders I work with frequently aside from cut-n-past methods.

So, all that IDX / CRON / MLS / RETS and other code snippets will also be going into the new online snippet DB.  I’ll post a link this weekend for those to cruise the code but keep in mind that although the design is done for the snippet DB its very sparse on content as of yet.


TEMP CODE: GDHXCDX17249629