From 9cbd60a0b04230eb7878a9ec6dd6dbe29c9b2af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 27 Apr 2016 14:05:27 +0200 Subject: [PATCH] Improve configuration docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- doc/config.rst | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/doc/config.rst b/doc/config.rst index ff606a1b07..1004615ff3 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -462,13 +462,13 @@ Server connection settings Whether config or cookie or :term:`HTTP` or signon authentication should be used for this server. - * 'config' authentication (``$auth_type = 'config'``) is the plain old + * 'config' authentication (``$auth_type = 'config'``) is the plain old way: username and password are stored in :file:`config.inc.php`. - * 'cookie' authentication mode (``$auth_type = 'cookie'``) allows you to + * 'cookie' authentication mode (``$auth_type = 'cookie'``) allows you to log in as any valid MySQL user with the help of cookies. * 'http' authentication allows you to log in as any valid MySQL user via HTTP-Auth. - * 'signon' authentication mode (``$auth_type = 'signon'``) allows you to + * 'signon' authentication mode (``$auth_type = 'signon'``) allows you to log in from prepared PHP session data or using supplied PHP script. .. seealso:: :ref:`authentication_modes` @@ -3005,14 +3005,34 @@ This example uses :file:`examples/signon.php` to demostrate usage of :ref:`auth_ .. code-block:: php ` +Example for IP address limited autologin +++++++++++++++++++++++++++++++++++++++++ + +If you want to automatically login when accessing phpMyAdmin locally while ask +for password when remotely, you can achieve it using following snippet: + +.. code-block:: php + + if ($_SERVER["REMOTE_ADDR"] == "127.0.0.1") { + $cfg['Servers'][$i]['auth_type'] = 'config'; + $cfg['Servers'][$i]['user'] = 'root'; + $cfg['Servers'][$i]['password'] = 'yourpassword'; + } else { + $cfg['Servers'][$i]['auth_type'] = 'cookie'; + } + +.. note:: + + Filtering based on IP addresses isn't reliable over the internet, use it + only for local address. .. _example-google-ssl: