add variable phpcompta_psql_host to set the postgres server on another server

This commit is contained in:
Dany De Bontridder 2009-10-27 20:07:16 +00:00
parent e1efdd7bb3
commit a32bd28a69
2 changed files with 5 additions and 1 deletions

View file

@ -116,6 +116,8 @@ function config_file_create($p_array,$from_setup=1,$os=1) {
fputs($hFile,"\n\r");
fputs($hFile, 'define ("phpcompta_psql_port","'.$cport.'");');
fputs($hFile,"\n\r");
fputs($hFile, 'define ("phpcompta_psql_host","127.0.0.1");');
fputs($hFile,"\n\r");
fputs($hFile, 'define ("domaine","");');
fputs($hFile,"\n\r");
fputs($hFile,'?>');

View file

@ -101,8 +101,9 @@ function DbConnect($p_db=-1,$p_type='dossier') {
$phpcompta_user=phpcompta_user;
$password=phpcompta_password;
$port=phpcompta_psql_port;
$host=( ! defined ("phpcompta_psql_host"))?'127.0.0.1':phpcompta_psql_host;
ob_start();
$a=pg_connect("dbname=$l_dossier host=127.0.0.1 user='$phpcompta_user'
$a=pg_connect("dbname=$l_dossier host='$host' user='$phpcompta_user'
password='$password' port=$port");
if ( $a == false )
@ -115,6 +116,7 @@ password='$password' port=$port");
echo "Domaine : ".domaine."<br>";
echo "Port $port <br>";
echo "Utilisateur : $phpcompta_user <br>";
echo "host : $host <br>";
exit ("Connection impossible : v&eacute;rifiez vos param&egrave;tres de base
de donn&eacute;es");