Joomla login verification, password encryption

Source: Internet
Author: User

The joomla password is not simply encrypted with MD5.

The password in the database is stored as follows: (both the user name and password are admin)

ab9989726cacc2a382866650fe6c809d:64tjXqkuMhKth3GK9o6uBMilMTJhKJIe

There is a colon separated in the middle. we record the first part as Part1 and the second part as Part2.

That is:

part1:part2

Although we do not know how Part2 is encrypted (if anyone knows this, please give us some advice !)

But by looking at the joomla source code, we can know that Part1 is like this, Part1 = MD5 (username. Part2 );

We can write our own functions to verify the user name and password.

<? Phpdefine ('_ jexec', 1); define ('jpath _ base', dirname (_ file __)); // This is when we are in the rootdefine ('ds', directory_separator); // introduce the joomla framework to use the joomla class library require_once (jpath_base.ds. 'regionder '. DS. 'defines. PHP '); require_once (jpath_base.ds. 'regionder '. DS. 'framework. PHP '); $ mainframe = & jfactory: getapplication ('SITE'); $ mainframe-> initialise (); $ user = & jfactory: getuser (); If (! $ User-> get ("username") {?> You have not logged on! <? PHP} else {echo $ user-> get ("password "). "<br>"; // echo juserhelper: getcryptedpassword ("admin"); // echo MD5 ("admin "); // use the joomla class library to query $ db = jfactory: getdbo (); $ query = $ db-> getquery (true); $ query-> select ('Id, password '); $ query-> from (' #__ Users '); $ query-> where ('username = '. $ db-> quote ('admin'); $ db-> setquery ($ query); $ result = $ db-> loadobject (); $ parts = explode (': ', $ result-> password); $ testcrypt = MD5 ("admin ". $ Pa RTS [1]); echo $ testcrypt;?> <? PHP }?>

ab9989726cacc2a382866650fe6c809d:64tjXqkuMhKth3GK9o6uBMilMTJhKJIeab9989726cacc2a382866650fe6c809d

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.