DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:authmysql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:authmysql [2015-07-30 12:22] 101.231.32.50plugin:authmysql [2024-02-10 22:58] (current) Klap-in
Line 7: Line 7:
 type       : Auth type       : Auth
 lastupdate : 2014-02-15 lastupdate : 2014-02-15
-compatible : (bundled)+compatible : (bundled up to version Greebo)
 depends    :  depends    : 
 conflicts  conflicts 
 similar    :  similar    : 
-tags       : !bundled+tags       : !discontinued
  
 downloadurl:  downloadurl: 
-bugtracker : # eg. https://github.com/splitbrain/dokuwiki/issues +bugtracker : # eg. https://github.com/dokuwiki/dokuwiki/issues 
-sourcerepo : https://github.com/splitbrain/dokuwiki/tree/master/lib/plugins/authmysql+sourcerepo : https://github.com/dokuwiki/dokuwiki/tree/master/lib/plugins/authmysql
 donationurl:  donationurl: 
 ---- ----
 +:!: **The authMySQL plugin is **[[devel:deprecated]]**.\\ Please use its replacement: the [[plugin:authPDO]] plugin.** The authMySQL plugin was bundled up to Greebo (2018-04-22).
  
 ===== Description ===== ===== Description =====
Line 28: Line 28:
 ===== Usage ===== ===== Usage =====
 Before this plugin can be used, you need to setup some settings: Before this plugin can be used, you need to setup some settings:
-  - Activate the authMySQL plugin in the [[plugin|Plugin Manager]].+  - Activate the authMySQL plugin in the [[plugin:extension|Extension Manager]].
   - Define the database in the [[config|Configuration Manager]]   - Define the database in the [[config|Configuration Manager]]
   - Define also the statements that performs the authentication and administration actions.   - Define also the statements that performs the authentication and administration actions.
Line 57: Line 57:
   * [[plugin:authmysql:projectpier|ProjectPier]] - collaboration system: [[http://projectpier.org|http://projectpier.org]]   * [[plugin:authmysql:projectpier|ProjectPier]] - collaboration system: [[http://projectpier.org|http://projectpier.org]]
   * [[plugin:authmysql:typo3|Typo3]] - an enterprise related content management system (CMS)   * [[plugin:authmysql:typo3|Typo3]] - an enterprise related content management system (CMS)
 +  * [[plugin:authmysql:contao|Contao]] - a content management system (CMS)
   * [[plugin:authmysql:vbulletin|VBulletin]] - a message board / forum   * [[plugin:authmysql:vbulletin|VBulletin]] - a message board / forum
   * [[plugin:authmysql:wbb|Woltlab Burning Board]] - a message board / forum   * [[plugin:authmysql:wbb|Woltlab Burning Board]] - a message board / forum
Line 83: Line 84:
 If you setup authmysql plugin configuration using [[plugin:config|Configuration Manager]], your auth settings are stored in ''conf/local.php''. But please be careful of unintentional change of your configuration. In order to avoid eventual loss of your configuration, especially of user authentication, it is preferable that auth settings should be defined in ''conf/local.protected.php'' (please create it if it doesn't exist). If you setup authmysql plugin configuration using [[plugin:config|Configuration Manager]], your auth settings are stored in ''conf/local.php''. But please be careful of unintentional change of your configuration. In order to avoid eventual loss of your configuration, especially of user authentication, it is preferable that auth settings should be defined in ''conf/local.protected.php'' (please create it if it doesn't exist).
  
-The common settings for AuthMySQL plugin will be found in ''[[https://github.com/splitbrain/dokuwiki/blob/master/conf/mysql.conf.php.example|conf/mysql.conf.php.example]]'' which is included in the DokuWiki distribution. You can copy it to another file (''mysql.conf.php'' for example), and edit the file to fit your needs. (This way you don't have to try and copy/paste all the code below). Then edit ''conf/local.protected.php'' for your settings to be loaded by your DokuWiki installation like:+The common settings for AuthMySQL plugin will be found in ''[[https://github.com/dokuwiki/dokuwiki/blob/master/conf/mysql.conf.php.example|conf/mysql.conf.php.example]]'' which is included in the DokuWiki distribution. You can copy it to another file (''mysql.conf.php'' for example), and edit the file to fit your needs. (This way you don't have to try and copy/paste all the code below). Then edit ''conf/local.protected.php'' for your settings to be loaded by your DokuWiki installation like:
  
 <code php conf/local.protected.php> <code php conf/local.protected.php>
Line 120: Line 121:
  
  
-All options explained assuming to use with a [[#example database|Sample Database]] which stores the first and last name of the users in one field. The common example for AuthMySQL plugin -- ''[[https://github.com/splitbrain/dokuwiki/blob/master/conf/mysql.conf.php.example|conf/mysql.conf.php.example]]'' -- included in the DokuWiki distribution also assumes the sample database database. At the bottom of this page is also an example how to [[#Store first and last name separated]].+All options explained assuming to use with a [[#example database|Sample Database]] which stores the first and last name of the users in one field. The common example for AuthMySQL plugin -- ''[[https://github.com/dokuwiki/dokuwiki/blob/master/conf/mysql.conf.php.example|conf/mysql.conf.php.example]]'' -- included in the DokuWiki distribution also assumes the sample database database. At the bottom of this page is also an example how to [[#Store first and last name separated]].
  
  
Line 600: Line 601:
  
 ===== Issues ===== ===== Issues =====
-For reporting issues about this AuthMySQL plugin, please refer to https://github.com/splitbrain/dokuwiki/issues.+For reporting issues about this AuthMySQL plugin, please refer to https://github.com/dokuwiki/dokuwiki/issues.
  
-===== Discussion =====+===== PHP 7 & MYSQLI =====
  
 +Unfortunately this plugin does not work with PHP7, which has deprecated all the **MYSQL_ ** functions.  The current mysqlauth plugin does not match [[auth:mysql#using_php_mysqli_library|the fixes suggested]] by Jacket.  It's largely the same, but there was one line that was still killing the operation with PHP7.
 +
 +Here's the stock authmysql file, updated to mysqli: [[https://nfgworld.com/files/authmysql.zip|authmysql.zip]].  Almost all of the fixes were as described in Jacket's patch file, but for one function (below).  The commented out line was the original, but it seemed to be checking something that didn't need to be checked, and it caused an error 500, so I simply removed it.  The empty lines are where its error result code went.  
 +
 +It's probably a dangerous chunk of code, so you shouldn't use it, but I use it and it seems fine.  Be careful.  =)
 +
 +<code php>    protected function _openDB() {
 +        if(!$this->dbcon) {
 +            $con = mysqli_connect($this->getConf('server'), $this->getConf('user'), conf_decodeString($this->getConf('password')), $t
 +            if($con) {
 +                // if((if (mysqli_connect_errno()) mysqli_select_db($this->getConf('database'), $con))) {
 +                    if((preg_match('/^(\d+)\.(\d+)\.(\d+).*/', mysqli_get_server_info($con), $result)) == 1) {
 +                        $this->dbver = $result[1];
 +                        $this->dbrev = $result[2];
 +                        $this->dbsub = $result[3];
 +                    }
 +                    $this->dbcon = $con;
 +                    if($this->getConf('charset')) {
 +                         mysqli_query('SET CHARACTER SET "'.$this->getConf('charset').'"', $con);
 +                    }
 +                    return true; // connection and database successfully opened
 +
 +
 +            } else {
 +                $this->_debug(
 +                    "MySQL err: Connection to {$this->getConf('user')}@{$this->getConf('server')} not possible.",
 +                    -1, __LINE__, __FILE__
 +                );
 +            }
 +
 +            return false; // connection failed
 +        }
 +        return true; // connection already open
 +    }</code>
 +
 + --- [[user>NFG|NFG]] //2018-03-16 01:40//
 +
 +===== Discussion =====
  
 **Wishlist** **Wishlist**
plugin/authmysql.1438251760.txt.gz · Last modified: 2015-07-30 12:22 by 101.231.32.50

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki