<bdo id='Uj43u'></bdo><ul id='Uj43u'></ul>

      1. <legend id='Uj43u'><style id='Uj43u'><dir id='Uj43u'><q id='Uj43u'></q></dir></style></legend>
        <i id='Uj43u'><tr id='Uj43u'><dt id='Uj43u'><q id='Uj43u'><span id='Uj43u'><b id='Uj43u'><form id='Uj43u'><ins id='Uj43u'></ins><ul id='Uj43u'></ul><sub id='Uj43u'></sub></form><legend id='Uj43u'></legend><bdo id='Uj43u'><pre id='Uj43u'><center id='Uj43u'></center></pre></bdo></b><th id='Uj43u'></th></span></q></dt></tr></i><div id='Uj43u'><tfoot id='Uj43u'></tfoot><dl id='Uj43u'><fieldset id='Uj43u'></fieldset></dl></div>
      2. <small id='Uj43u'></small><noframes id='Uj43u'>

        <tfoot id='Uj43u'></tfoot>

        Joomla 3.2.1 密码加密

        时间:2023-10-10
          <i id='eZa3P'><tr id='eZa3P'><dt id='eZa3P'><q id='eZa3P'><span id='eZa3P'><b id='eZa3P'><form id='eZa3P'><ins id='eZa3P'></ins><ul id='eZa3P'></ul><sub id='eZa3P'></sub></form><legend id='eZa3P'></legend><bdo id='eZa3P'><pre id='eZa3P'><center id='eZa3P'></center></pre></bdo></b><th id='eZa3P'></th></span></q></dt></tr></i><div id='eZa3P'><tfoot id='eZa3P'></tfoot><dl id='eZa3P'><fieldset id='eZa3P'></fieldset></dl></div>

            <small id='eZa3P'></small><noframes id='eZa3P'>

                <tbody id='eZa3P'></tbody>
              <legend id='eZa3P'><style id='eZa3P'><dir id='eZa3P'><q id='eZa3P'></q></dir></style></legend>
                • <bdo id='eZa3P'></bdo><ul id='eZa3P'></ul>
                  <tfoot id='eZa3P'></tfoot>

                  本文介绍了Joomla 3.2.1 密码加密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当用户在网站上注册时,我在数据库 joomla_users 的密码表中查找,有以下格式存储的密码:

                  When the user register on the site , and I look in the database joomla_users in the password table, there are password stored in the following formats:

                  • $P$Do8QrURFT1r0NlWf0X/grdF/aMqwqK/

                  • $P$Do8QrURFT1r0NlWf0X/grdF/aMqwqK/

                  $P$DH38Lch9z508gJiop3A6u0whTity390

                  $P$DH38Lch9z508gJiop3A6u0whTity390

                  但不是文档中描述的形式(MD5 + ":" + SALT):

                  But not in the form as described in the documentation (MD5 + ":" + SALT):

                  • 1802ebc64051d5b4f4d1b408babb5020:0PHJDbnsyX05YpKbAuLYnw2VCzFMW2VK

                  我需要为我澄清这一点,因为我正在使用检查用户凭据的外部脚本来检查密码匹配.

                  I need to have this clarified for me, because I'm using outside script that checks for user credentials to check for password match.

                  在我的 PHP 脚本中,我的代码将 SALT 与数据库中的密码分开:

                  In my PHP script I have code that seperates SALT from password from database:

                  $parts   = explode( ':', $password_database );
                  $crypt   = $parts[0];
                  $salt   = $parts[1];
                  

                  但是如果没有双结我就做不到 (:)

                  But I can't do that if there is no dobule knot (:)

                  推荐答案

                  试试这个,

                  以下代码正在创建 Joomla 标准密码(旧版本 1.5、1.7 等).

                  The following piece of code is creating Joomla standard password (Older Version 1.5,1.7 etc).

                   jimport('joomla.user.helper');
                   $salt = JUserHelper::genRandomPassword(32);
                   $crypt = JUserHelper::getCryptedPassword($password_choose, $salt);
                   $password = $crypt.':'.$salt;
                  

                  Joomla 3.2+ 引入了 PHP 的密码算法 bcrypt,但它至少需要 PHP 5.3+ 如果您打算使用 bcrypt 确保您的服务器 PHP 版本能够执行此操作,在此处阅读更多信息.

                  Joomla 3.2+ introduced PHP's password algorithm bcrypt but it required a minimum PHP 5.3+ If you plan to use bcrypt make sure your server PHP version is capable for this, read more here.

                  其他版本的 Joomla 使用以下方法(Joomla 3.x)

                  The other Version of Joomla Using the following methods (Joomla 3.x)

                   jimport('joomla.user.helper');
                   $yourpass = JUserHelper::hashPassword($password_choose);
                  

                  旧算法在最新版本中也能正常工作,唯一的区别是旧版本创建 65 个字符的密码,而新版本创建 34 个字符的字符串.始终使用更新版本

                  此外,如果您使用外部脚本,则应包含 Joomla 框架,如下所示.这应该在您的外部 php 文件的最顶部

                  Also if you are using external script should include Joomla framework like below. This should at very top of your external php file

                  define( '_JEXEC', 1 );
                  define('JPATH_BASE', dirname(__FILE__) );//this is when we are in the root
                  define( 'DS', DIRECTORY_SEPARATOR );
                  
                  require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
                  require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
                  
                  $mainframe =& JFactory::getApplication('site');
                  $mainframe->initialise();
                  

                  您还提到您必须检查用户凭据,然后无需检查密码格式,所有内容只需在框架加载后使用以下代码即可.

                  Also you mentioned you have to check users credential then no need to check password format and all thing just use below codes after framework loads.

                     $credentials['username'] = $data['username']; //user entered name
                     $credentials['password'] = $data['password']; //users entered password
                     $app = JFactory::getApplication();
                     $error = $app->login($credentials, $options);
                     if (!JError::isError($error)) {
                      // login success
                      }
                    else{
                      //Failed attempt
                     }
                  

                  希望有帮助..

                  这篇关于Joomla 3.2.1 密码加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:多个服务层和数据库事务 下一篇:仅向注册用户显示 joomla 文章,如果未登录则显示登录屏幕是

                  相关文章

                • <legend id='rGWh4'><style id='rGWh4'><dir id='rGWh4'><q id='rGWh4'></q></dir></style></legend>

                    <bdo id='rGWh4'></bdo><ul id='rGWh4'></ul>
                  <i id='rGWh4'><tr id='rGWh4'><dt id='rGWh4'><q id='rGWh4'><span id='rGWh4'><b id='rGWh4'><form id='rGWh4'><ins id='rGWh4'></ins><ul id='rGWh4'></ul><sub id='rGWh4'></sub></form><legend id='rGWh4'></legend><bdo id='rGWh4'><pre id='rGWh4'><center id='rGWh4'></center></pre></bdo></b><th id='rGWh4'></th></span></q></dt></tr></i><div id='rGWh4'><tfoot id='rGWh4'></tfoot><dl id='rGWh4'><fieldset id='rGWh4'></fieldset></dl></div>

                  1. <small id='rGWh4'></small><noframes id='rGWh4'>

                      <tfoot id='rGWh4'></tfoot>