note 22678 added to function.mysql-pconnect

From: Date: Wed, 26 Jun 2002 17:59:26 +0000
Subject: note 22678 added to function.mysql-pconnect
Groups: php.notes 
Request: Send a blank email to php-notes+get-32232@lists.php.net to get a copy of this message
I have the following function and there is a highy insecure intermittent problem with it. Every now and then, I get a "Warning: Access denied for user: 'password@localhost' (Using password: YES) instead of it working properly. Even if the mysql server denied the connection, it should be 'access denied for user: username@localhost' and should never print the password in cleartext to the browser. What's happening here? Any help would be GREATLY appreciated! PHP 4.1.1 compiled into apache as a module.. running mysql 3.23.41 //Perform a query and return the result function query( $query_string, $db = "database" , $username = "username", $password = "password", $host = "localhost" ){ global $sql; //Assume all vars, except DB name $sql = mysql_pconnect("$host","$username","$password"); if( !$sql ){ print( "Error: Connecting to Database." ); exit; } mysql_select_db( $db, $sql ); $result=mysql_query( $query_string, $sql ); if( !$result ){ print( "Error: Connecting to Database.<BR>" ); print( mysql_error( $sql ) ); exit; } return $result; } -- http://www.php.net/manual/en/function.mysql-pconnect.php http://master.php.net/manage/user-notes.php?action=edit+22678 http://master.php.net/manage/user-notes.php?action=delete+22678 http://master.php.net/manage/user-notes.php?action=reject+22678

« previous php.notes (#32232) next »