[eluser]dathan[/eluser]
Here's a fix to the the previous patch. Apparently when I posted it it had a couple syntax errors.
Code:
Index: postgre_driver.php
===================================================================
--- postgre_driver.php (revision 1245)
+++ postgre_driver.php (working copy)
@@ -46,9 +46,18 @@
*/
function db_connect()
{
- $port = ($this->port == '') ? '' : " port=".$this->port;
-
- return @pg_connect("host=".$this->hostname.$port." dbname=".$this->database." user=".$this->username." password=".$this->password);
+ $params = array();
+ if ($this->port !== '')
+ $params[] = 'port='.$this->port;
+ if ($this->hostname !== '')
+ $params[] = 'host='.$this->hostname;
+ if ($this->database !== '')
+ $params[] = 'dbname='.$this->database;
+ if ($this->username !== '')
+ $params[] = 'user='.$this->username;
+ if ($this->password !== '')
+ $params[] = 'password'.$this->password;
+ return @pg_connect(implode(" ", $params));
}
// --------------------------------------------------------------------
@@ -61,9 +70,18 @@
*/
function db_pconnect()
{
- $port = ($this->port == '') ? '' : " port=".$this->port;
-
- return @pg_pconnect("host=".$this->hostname.$port." dbname=".$this->database." user=".$this->username." password=".$this->password);
+ $params = array();
+ if ($this->port !== '')
+ $params[] = 'port='.$this->port;
+ if ($this->hostname !== '')
+ $params[] = 'host='.$this->hostname;
+ if ($this->database !== '')
+ $params[] = 'dbname='.$this->database;
+ if ($this->username !== '')
+ $params[] = 'user='.$this->username;
+ if ($this->password !== '')
+ $params[] = 'password'.$this->password;
+ return @pg_pconnect(implode(" ", $params));
}
// --------------------------------------------------------------------
Mod edit: stuck code inside [code][/code] tags for legibility