thephoenics
New Member
- Messages
- 12
- Reaction score
- 0
- Points
- 0
dear sir,
I am using Intermediate PHP Plan. I wish to use HTTP Authentication for my site, as it is really important to provide some security features. I am planning to implement it using PHP. I see here that HTTP Authentication is not possible using this. Can you please help me in this regard sir.
This is the code I use.
I would be really glad if you could help me in this matter,
Thank you sir,
Regards,
Kiran
I am using Intermediate PHP Plan. I wish to use HTTP Authentication for my site, as it is really important to provide some security features. I am planning to implement it using PHP. I see here that HTTP Authentication is not possible using this. Can you please help me in this regard sir.
This is the code I use.
I feel that it is because of some CGI / Apache Mod thing. The HTTP Authentication apparently doesn't work in CGI Mode.<?
if(!isset($_SERVER["PHP_AUTH_USER"]) || $_GET["logout"]) {
header("WWW-Authenticate: Basic realm=\"My Realm\"");
header("Status: 401 Unauthorized");
header("HTTP-Status: 401 Unauthorized");
if($_GET["logout"]) echo "You have logged out.\n";
else echo "Text to send if user hits Cancel button\n";
exit;
}
else {
echo "Hello " . $_SERVER["PHP_AUTH_USER"] . ".<BR>";
echo "You entered " . $_SERVER["PHP_AUTH_PW"] . " as your password.
";
echo "<a href=$PHP_SELF?logout=1>Click here to logout</a>";
}
?>
I would be really glad if you could help me in this matter,
Thank you sir,
Regards,
Kiran
Last edited: