Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 想给phpmyadmin加一个验证码但找不到验证的地方,可否告知一下

想给phpmyadmin加一个验证码但找不到验证的地方,可否告知一下

Jun 23, 2016 pm 02:03 PM

想给phpmyadmin加一个验证码??但找不到验证的地方,可否告知一下。



毕竟没有验证码很容易被社工的。同时我也想JS加密密码,然后再用PHP解密。

知道的告知一下。谢谢。


回复讨论(解决方案)

设置一下,让它登录后才能访问还不可以吗

设置一下,让它登录后才能访问还不可以吗

可以说要仔细一点吗??不是很明白。
我是想加一个验证码或者对密码进行加密也行。

呵呵,那你就得去改改phpmyadmin的源码了。

它自带的就有登录功能

呵呵,那你就得去改改phpmyadmin的源码了。

它自带的就有登录功能

这个我知道呀,但它验证用户各与密码的地方在那里,我找了好长时间,就是找不到。

是用户名与密码

来个高手吧,到底在那里修改呢???

登录表单在 libraries/auth/cookie.auth.lib.php 240 行附近
有关用户名的操作在该文件450行附近

    if (! empty($_REQUEST['pma_username'])) {        // The user just logged in        $GLOBALS['PHP_AUTH_USER'] = $_REQUEST['pma_username'];        $GLOBALS['PHP_AUTH_PW']   = empty($_REQUEST['pma_password']) ? '' : $_REQUEST['pma_password'];        if ($GLOBALS['cfg']['AllowArbitraryServer'] && isset($_REQUEST['pma_servername'])) {            $GLOBALS['pma_auth_server'] = $_REQUEST['pma_servername'];        }        return true;    }
Copy after login

phpmysqladmin 本身不需要验证用户名和口令的真伪
因为户名和口令是给 mysql 用的,错了就连接不上数据库

@xuzuning 版主

phpmyadmin不连接mysql怎样操作数据库里的东西呢?我觉得纳闷呢。又在那里将这些信息传给mysql呢??

@xuzuning 版主

网上很多都讲怎样用phpMyAdmin连接mysql,但并没有说明如何修改phpMyAdmin加验证码以加强安全性。

不然,有人不停地扫,一般情况下,一个小菜鸟,两三天,估计也扫出来了。

phpmyadmin不连接mysql怎样操作数据库里的东西呢?我觉得纳闷呢。又在那里将这些信息传给mysql呢?? 你是误解了我的意思了
phpmyadmin 本身是不需要登陆的
需要输入的是访问数据库的用户名和口令
因此 phpmyadmin 没有提供验证,也无法判断登入 mysql 的用户名和口令是否合法

如果你连你的 phpmyadmin 的入口都公开了出来,那还担心人家“扫”干什么?

引用 8 楼 bluewjzhhr 的回复:phpmyadmin不连接mysql怎样操作数据库里的东西呢?我觉得纳闷呢。又在那里将这些信息传给mysql呢??你是误解了我的意思了
phpmyadmin 本身是不需要登陆的
需要输入的是访问数据库的用户名和口令
因此 phpmyadmin 没有提供验证,也无法判断登入 mysql 的用户名和口令是否合法

如果你连……

版主,不是我主动公开的,也许是黑客通过某种方法探测到的。

还有呀:

 if (! empty($_REQUEST['pma_username'])) {        // The user just logged in        $GLOBALS['PHP_AUTH_USER'] = $_REQUEST['pma_username'];        $GLOBALS['PHP_AUTH_PW']   = empty($_REQUEST['pma_password']) ? '' : $_REQUEST['pma_password'];        if ($GLOBALS['cfg']['AllowArbitraryServer'] && isset($_REQUEST['pma_servername'])) {            $GLOBALS['pma_auth_server'] = $_REQUEST['pma_servername'];        }        return true;    }
Copy after login


我怎么看,都觉得这个不是验证用户名登录的地方呀??是不是在其它地方??

你把 phpmyadmin 的入口甚至目录都改个名,不就可以免除挡墙的“攻击”了吗
我没说那是用户验证吧?我只是说与登录名相关,是吧?
况且,我再三的说了,phpmyadmin是不需要登录的,用户登录只是为了连接mysql而设的

这个我理解,知道用户登录是为了连接mysql设计的,你知道在那里进行:

"select * from user where user='".$user."' and password='".$password."'";

的吗???

这个我理解,知道用户登录是为了连接mysql设计的,你知道在那里进行:

"select * from user where user='".$user."' and password='".$password."'";

的吗???

我想版主的意思是  phpmyadmin只是提供接口传入mysql用户名和密码进行连接的。所以应该找具体在哪里执行mysql_connect(xx,xx,xx),然后对连接的状态进行判断。至于你说的执行这句sql,应该是在mysql数据库内部执行的了;或许mysql自身有个表是用来放用户信息的。

引用 13 楼 bluewjzhhr 的回复:这个我理解,知道用户登录是为了连接mysql设计的,你知道在那里进行:

"select * from user where user='".$user."' and password='".$password."'";

的吗???

我想版主的意思是  phpmyadmin只是提供接口传入mysql用户名和密码……


我知道版主的意思,是我的表述不清楚。

找了三个晚上,依然无结果。想给phpMyAdmin加一个验证码,杂就这么难呢?????

本帖最后由 xuzuning 于 2012-12-20 16:46:41 编辑
            登录表单在 libraries/auth/cookie.auth.lib.php 240 行附近
有关用户名的操作在该文件450行附近PHP code?123456789    if (! empty($_REQUEST['pma_username'])) {……

引用 7 楼 xuzuning 的回复:本帖最后由 xuzuning 于 2012-12-20 16:46:41 编辑
            登录表单在 libraries/auth/cookie.auth.lib.php 240 行附近
有关用户名的操作在该文件450行附近PHP code?123456789    if (! empty($_REQUEST['p……


发现mysql的加密方式为sha1(unhex(sha1('xxx')))这样的,我直接在JS前端加密后,再传回去,然后直接的密码对比就行了。这样不更安全些????????

不相信这样的密码,谁破解的了。也不用为其它的明文传输密码问题而发愁了。

很简单的问题 提交页面和显示页面都加个东西就可以啊

很简单的问题 提交页面和显示页面都加个东西就可以啊

关键是phpMyAdmin里验证密码的地方在那里,找不到呀!!!!!!

关键是phpMyAdmin里验证密码的地方在那里,找不到呀!!!!!!
问题是 phpMyAdmin 不验证密码,因为密码是给 mysql 用的,php中无法验证
要说几遍才能明白呢?

一般使用 phpMyAdmin 时都将用户名和密码写在 config 文件里的

用户名或密码错了,就连不上 mysql,此时 mysql 会给出相应的错误信息
这和你到银行取钱是一个道理,柜员受理你的业务,密码得由你自己输,输错了他就转告你错了

表述不准确,请版主谅解

phpMyAdmin 总得去mysql中找用户名与密码同时存在的记录吧,不去mysql中查找,怎么知道有此用户呢?

我想知道phpMyAdmin 是怎样把用户名与密码给到mysql的。


找到了:
 在common.inc.php里面大概第945行:

// Connects to the server (validates user's login)
$userlink = PMA_DBI_connect($cfg['Server']['user'], $cfg['Server']['password'], false);

谢谢版主了。

前面我已经说了
$GLOBALS['PHP_AUTH_USER'] = $_REQUEST['pma_username'];
$GLOBALS['PHP_AUTH_PW']   = empty($_REQUEST['pma_password']) ? '' : $_REQUEST['pma_password'];
这就是缓存传入的用户名和口令的
当然还有几处类似的地方

当你连接 mysql 时需要执行 mysql_connect('localhost', $username, $parssword); 这样是吧?
这个 $username 和 $parssword 不就是传入的或预置的用户名和口令吗
这就是 phpmyadmin 让你输入的用户名和口令和口令,是用于连接数据库的
当数据库还没有连接时,phpmydamin 如何到 mysql 中去查找用户名和口令呢?
那么如果数据库已经连接上了,验证这个用户名和口令又有什么用呢?
当然,连接时 mysql 本身也要去 user 表验证用户名和口令的,但你是干预不了的

这和你的应用系统是不一样的,你的应用系统的用户名和口令的确是要在连接mysql后去表中验证用户名和口令
估计你把这两个混淆了

@xuzuning
有个奇怪的事要问下:验证码加上了,但验证码生成的session或者cookie进不了phpMyAdmin里面,换句话说:phpMyAdmin应该在某个地方把session给注销掉了。目前验证码是可以正常显示,但使用不了。

谁弄好了,说下。快整死我了

云里雾里的。
嗷嗷。。。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How does session hijacking work and how can you mitigate it in PHP? How does session hijacking work and how can you mitigate it in PHP? Apr 06, 2025 am 12:02 AM

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to debug CLI mode in PHPStorm? How to debug CLI mode in PHPStorm? Apr 01, 2025 pm 02:57 PM

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

What are Enumerations (Enums) in PHP 8.1? What are Enumerations (Enums) in PHP 8.1? Apr 03, 2025 am 12:05 AM

The enumeration function in PHP8.1 enhances the clarity and type safety of the code by defining named constants. 1) Enumerations can be integers, strings or objects, improving code readability and type safety. 2) Enumeration is based on class and supports object-oriented features such as traversal and reflection. 3) Enumeration can be used for comparison and assignment to ensure type safety. 4) Enumeration supports adding methods to implement complex logic. 5) Strict type checking and error handling can avoid common errors. 6) Enumeration reduces magic value and improves maintainability, but pay attention to performance optimization.

How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

See all articles