if ($user || $pwd || $db) {\r
if ($str) {\r
$host = split(":", $str);\r
- if ($host[0]) $str = "host=$host[0]";\r
+ if ($host[0]) $str = "host='" . addslashes($host[0]) . "'";\r
else $str = 'localhost';\r
- if (isset($host[1])) $str .= " port=$host[1]";\r
+ if (isset($host[1])) $str .= " port='" . addslashes($host[1]) . "'";\r
}\r
- if ($user) $str .= " user='{$user}'";\r
- if ($pwd) $str .= " password='{$pwd}'";\r
- if ($db) $str .= " dbname='{$db}'";\r
+ if ($user) $str .= " user='" . addslashes($user) . "'";\r
+ if ($pwd) $str .= " password='" . addslashes($pwd) . "'";\r
+ if ($db) $str .= " dbname='" . addslashes($db) . "'";\r
}\r
\r
- //if ($user) $linea = "user=$user host=$linea password=$pwd dbname=$db port=5432";\r
$this->_connectionID = @pg_connect($str);\r
\r
if ($this->_connectionID === false) return false;\r
function _pconnect($str,$user='',$pwd='',$db='')\r
{\r
if ($user || $pwd || $db) {\r
- if ($str) {\r
+ if ($str) {\r
$host = split(":", $str);\r
- if ($host[0]) $str = "host=$host[0]";\r
+ if ($host[0]) $str = "host='" . addslashes($host[0]) . "'";\r
else $str = 'localhost';\r
- if (isset($host[1])) $str .= " port=$host[1]";\r
+ if (isset($host[1])) $str .= " port='" . addslashes($host[1]) . "'";\r
}\r
- if ($user) $str .= " user='{$user}'";\r
- if ($pwd) $str .= " password='{$pwd}'";\r
- if ($db) $str .= " dbname='{$db}'";\r
- }//print $str;\r
+ if ($user) $str .= " user='" . addslashes($user) . "'";\r
+ if ($pwd) $str .= " password='" . addslashes($pwd) . "'";\r
+ if ($db) $str .= " dbname='" . addslashes($db) . "'";\r
+ }\r
+\r
$this->_connectionID = @pg_pconnect($str);\r
+\r
if ($this->_connectionID === false) return false;\r
$this->Execute("set datestyle='ISO'");\r
return true;\r