Fix: Ajout test si paramtre host invalide

This commit is contained in:
Laurent Destailleur
2005-03-23 22:10:38 +00:00
parent 3ab89e5c3a
commit fff87a117b
2 changed files with 23 additions and 13 deletions

View File

@@ -84,15 +84,21 @@ class DoliDb
global $conf;
$this->transaction_opened=0;
if ($host == '') $host = $conf->db->host;
if ($user == '') $user = $conf->db->user;
if ($pass == '') $pass = $conf->db->pass;
if ($name == '') $name = $conf->db->name;
if (! $host) $host = $conf->db->host;
if (! $user) $user = $conf->db->user;
if (! $pass) $pass = $conf->db->pass;
if (! $name) $name = $conf->db->name;
//print "Name DB: $host,$user,$pass,$name<br>";
if (! $host)
{
$this->connected = 0;
$this->ok = 0;
dolibarr_syslog("DoliDB::DoliDB : Erreur Connect, wrong host parameters");
return $this->ok;
}
// Essai connexion serveur
$this->db = $this->connect($host, $user, $pass, $newlink);
if ($this->db)
@@ -108,7 +114,6 @@ class DoliDb
}
// Si connexion serveur ok et si connexion base demand<6E>e, on essaie connexion base
if ($this->connected && $name)
{
if ($this->select_db($name) == 1)