So, I've been trying several ways of authentication for a section of my site, the htaccess/passwd route doesn't seem to work though. So, I went out and found a php script, the login box pops up ok, I enter the right user/pass but then it just loops, any ideas please?
This is the code.
Any other methods of securing a directory are very welcome, and thanks in advance.
This is the code.

Code:
<?
//part 1
if (!isset($PHP_AUTH_USER))
{
header("WWW-Authenticate: Basic realm=\"Login\"");
Header("HTTP/1.0 401 Unauthorized");
exit;
}
//part 2
else if(($PHP_AUTH_USER=="user") && ($PHP_AUTH_PW=="password"))
{
echo "You got in...";
}
//part 3
else
{
echo "<html><body bgcolor=ffffcc>Failed, please try again.";
//fail try again
}
?>
Any other methods of securing a directory are very welcome, and thanks in advance.
