dvwa 源码分析(三) --- config.inc.php分析

<?php

# If you are having problems connecting to the MySQL database and all of the variables below are correct
# try changing the 'db_server' variable from localhost to 127.0.0.1. Fixes a problem due to sockets.
# Thanks to digininja for the fix.

# Database management system to use

$DBMS = 'MySQL';
#$DBMS = 'PGSQL';

# Database variables

$_DVWA = array();
$_DVWA[ 'db_server' ] = 'localhost';
$_DVWA[ 'db_database' ] = 'dvwa';
$_DVWA[ 'db_user' ] = 'root';
$_DVWA[ 'db_password' ] = '';

# Only needed for PGSQL
$_DVWA[ 'db_port' ] = '5432'; 

?>

代码很简单,创建一个变量DBMS,表示使用的数据库类型,默认为MySQL。

然后创建一个数组,数组中包含了数据库连接的相关信息,但没有定义使用的数据库名,可以看出我们只是连接到数据库,但没有选择数据库。

你可能感兴趣的:(config)