I remember before if you made the little "security pop-up box" through raw headers appear, the input the user entered was stored in the PHP globals $PHP_AUTH_USER, $PHP_AUTH_PW and $PHP_AUTH_TYPE.
Anyways, I was wondering why my security code wasn't working so I did some testing and found out it wasn't regestering the password I entered into the security popup box. This is my code currently, it's a bit long and messy:
$dir = dirname($SCRIPT_FILENAME);
if (strstr($dir,"secure"))
{
if (!isset($PHP_AUTH_USER))
{
Header("WWW-Authenticate: Basic realm=Admin");
Header("HTTP/1.0 401 Unauthorized");
require_once("../../include/header.inc");
CommonHeader("../../../images/admin.jpg", 375);
echo '<center>';
echo 'Authorization Required.';
include("../../include/footer.inc");
exit;
} else {
$line = file($admininfo);
// For as long as $i is <= the size of the $line array,
// explode each array element into a username and password pair
for( $i = 0; $i < count($line) ; $i++)
{
$datapair = explode("terjtrt596mpter20;", $line[$i]);
$password = strrev($datapair[1]);
if (($PHP_AUTH_USER == $datapair[0]) && ($PHP_USER_PW == $password))
{
$auth = "1";
break;
} else {
$auth = "0";
}
}
if ($auth == "1")
{
} else {
Header("WWW-Authenticate: Basic realm=Admin");
Header("HTTP/1.0 401 Unauthorized");
require_once("../../include/header.inc");
CommonHeader("../../../images/admin.jpg", 375);
echo '<center>';
echo 'Authorization Required.';
print ("$PHP_AUTH_USER<br>$datapair[0]<br><br>$PHP_USER_PW<br>$password<br>");
include("../../include/footer.inc");
exit;
}
}
}