HTTP Authentification problem

I’ve created a simple HTTP authentification system that works perfectly on my computer:


//This function validates if the user input it's correct
function auth($name,$password) { 
$sql = "select * from panel"; //Data from MySQL 
$query = mysql_query($sql); 
$row = mysql_fetch_array($query); 
$mysql_name = $row['name']; 
$mysql_password = $row['password']; 

if($name != $mysql_name and $password != $mysql_password) { 
   return false; 
 } else { 
   return true; 
   }
}

if(!auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])) { 
   header('WWW-Authenticate: Basic realm="Panel"'); 
   header('HTTP/1.0 401 Unauthorized'); 
   echo "error"; 
   exit(); 
} //if  

...the page content

However once I upload this code in the server the story it’s different. I get the dialog box (name, password) displayed, but no matter what I write, I cannot pass this dialog box. I’ve even get rid off the mysql part and use simple variables as name and password but the result it’s the same.

My configuration:
My Computer
Apache/2.0.59 (Win32)
PHP version:5.1.6
MySQL version:5.0.24a-community-nt

My Server
**Apache 1.3.37 (Unix)
MySQL 4.1.21-standard
PHP 4.4.3

Thanks! any idea will be great!
**