ENHANCEMENT Support for Windows authentication for MSSQLDatabase - this is a more secure way of connecting to the database server, because a username and password is not required in the _ss_environment.php file

This commit is contained in:
Sean Harvey 2009-11-12 09:23:46 +00:00
parent e4fe94aae3
commit 7e45cfda78

View File

@ -87,10 +87,16 @@ class MSSQLDatabase extends SS_Database {
if($this->mssql) {
$this->dbConn = mssql_connect($parameters['server'], $parameters['username'], $parameters['password'], true);
} else {
$this->dbConn = sqlsrv_connect($parameters['server'], array(
// Windows authentication doesn't require a username and password
if(defined('MSSQL_USE_WINDOWS_AUTHENTICATION') && MSSQL_USE_WINDOWS_AUTHENTICATION == true) {
$connectionInfo = array();
} else {
$connectionInfo = array(
'UID' => $parameters['username'],
'PWD' => $parameters['password'],
));
);
}
$this->dbConn = sqlsrv_connect($parameters['server'], $connectionInfo);
}
if(!$this->dbConn) {