Jump to content

Login postgresql denied??


Dorac

Recommended Posts

Im really stumped about this one. Really cant get it to work and its not that im changing the variable.. (even tho its a constant :P ) weird... here is my code. Please please pretty please help. Thanks a mill.

 

Its on a remote server.

 

Ive taken the host ip and pass out for obvious reasons.

 

//index.php

<?php
include("includes/config.php");
include("includes/functions.php");

$connection = pg_connect("host=*.*.*.* port=5432 dbname=bookdesign user=bookstar password=****");

include("side_pages/top_bar.php");
//side bar already included
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Book Design</title>
<link href="style.css" rel="stylesheet" type="text/css" /></head>

<body>
<table width="100%" border="0">
  
  <tr>
    <td width="180" align="left" valign="top" class="sidebar"><br />
      <?php include("side_pages/side_bar.php"); ?>
<br /></td>
    <td align="center" valign="top"><span class="headlines">News</span><br />
      <br />
      <?php getnews(); ?>
 </td>
  </tr>
</table>
</body>
</html>

 

as you notice there is no problem here, i can connect using the user and pass given... but when i use a function it gives

 

"Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: password authentication failed for user "SYSTEM" in C:\wamp\www\library\includes\functions.php on line 27

Couldn't Connect"

 

// config.php

<?php
$user_for_server_is = "myuser";
$pass_for_server_is = "****";

$the_server_is = "*.*.*.*";
$connect_on_port = "5432";
$database = "BookDesign";

///////////////////////////////////

define(HOST,$the_server_is);
define(PORT,$connect_on_port);
define(USER,$user_for_server_is);
define(PASS,$pass_for_server_is);
define(DATABASE,$database_is);
?>

 

thats all fine and dandy... now functions.php gives trouble :-/

 

 
function getnews() 
{
	$connection = pg_connect("host=".HOST." port=".PORT." dbname=".DATABASE." user=".USER." password=".PASS)
		or die("Couldn't Connect");
	$result = pg_query("SELECT title, newsdate, story FROM news");
	$result_row = pg_fetch_row($result);

	pg_close($result);


	echo ('
	<td class="newsbox">
          <h3 align="center"><strong>'.$result_row[0].' - '.$result_row[1].'</strong></h3>
          <table width="96%" align="center">
            <tr>
              <td>
		  	'.$result_row[2].'
		  </td>
            </tr>
          </table>
          <br /></td>
	 ');
}
?>

 

if i put the connect host port etc directly in config.php it works perfect. but if i put it in functions and call the function it error :

 

"Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: password authentication failed for user "SYSTEM" in C:\wamp\www\library\includes\functions.php on line 27

Couldn't Connect"

 

Any help will be much appreciated. :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.