hello
I have the following code
<?php
define( "DBCONNECTGENERAL", "host=localhost port=5432 user=hspa dbname=hspa" ) ;
require( "common.php" ) ;
if( strlen($PHP_AUTH_USER) == 0 || strlen($PHP_AUTH_PW) == 0 ||
!isset( $PHP_AUTH_USER ) || !isset( $PHP_AUTH_PW ) )
{
Header( "WWW-authenticate: Basic realm=\"restricted area\"" );
Header( "HTTP/1.0 401 Unauthorized" ) ;
exit;
}
else
{
$username = $PHP_AUTH_USER ;
$password = $PHP_AUTH_PW ;
$accountquery = "SELECT * FROM account WHERE id='$username' AND password='$password'" ;
$dbconnection = pg_connect( DBCONNECTGENERAL ) ;
$accountresult = pg_query( $dbconnection, $accountquery ) ;
if( $accountresult && pg_num_rows( $accountresult ) == 1 )
{
I cannot authenticate the user. I have had the code working on a different server, just not this one. This leads me to believe that it maybe something the way apache handles authentication.
I can connect to the database specified through another php script just not this one.
has anyone run into this at any time or maybe knows to to solve it?
Sorry if this is the wrong forum I figures it would fit better in here rather than database.
thanks