I'm using phptriad to install webserver on my PC (localhost) and try todo with this script below (HTTP user authentication), but it is FAILED (500 internal server error).
This below script is work when i upload to my commercial server hosting (not localhost)
Should i make changes to httpd.conf or what? please help me.
here is the script:
if (!isset($PHP_AUTH_USER)) {
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
else if (isset($PHP_AUTH_USER)) {
if (($PHP_AUTH_USER != "myuser") || ($PHP_AUTH_PW != "mypass")) {
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
else {
echo "Login Sucessfull";
}