I have been using a basic php script to password protect some pages on a site and it's been working well. The page that I want to protect has a 'require_once();' statement at the top, which references an "authorize.php" script, which I've included below.

Previously with each web client I would buy them their own shared hosting account at my hosting company, but I recently made a change and bought unlimited hosting. With this I can install all of the domain names that I work with in sub-directories within my parent, or public, directory. The domain names now point to their respective folders within my top-level directory. The problem I'm running into is that the password protect script stopped working. It now behaves as if I'm entering the wrong password. Here's what I use, no doubt it's very familiar to you all (keep in mind I'm a complete beginner and easily overwhelmed by an explanation that's not "newbie friendly"):

<?php
// User name and password for authentication
$username = 'username';
$password = 'password';

if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) ||
($_SERVER['PHP_AUTH_USER'] != $username) || ($_SERVER['PHP_AUTH_PW'] != $password)) {
// The user name/password are incorrect so send the authentication headers
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Banjos Rule!"');
exit('<h2>Banjos Rule!</h2>Sorry, you must enter a valid user name and password to access this page.');
}
?>

Now when I try to access the page that's protected, I get the standard pop-up box for entering usernames and passwords, but it doesn't recognize my password. It just keeps returning an error, although the password is right there in the script. Here's the path of the file:

"www.topleveldomain.com/piggybackeddomain_folder/file_being_referenced.php"

Any ideas on why it won't recognize my password? Thanks for your help.