Zbigniew Szalbot wrote:
Hello again,
On Thu, 26 Oct 2006, Chris wrote:
You'll need to change:
$PHP_AUTH_USER to $_SERVER['PHP_AUTH_USER'] and $PHP_AUTH_PW to
$_SERVER['PHP_AUTH_PW']
The former variables are ok before 4.2.0 (where register_globals was
off by default I think) but now they have moved to the $_SERVER
super-global.
Read http://www.php.net/manual/en/language.variables.predefined.php
Thanks a lot again! I am so thankful for your help! It did work. But I
have a curious observation. I can only log in when I delete the password
and just log in using my login. As soon as I write password with field
type PASSWORD or OLD_PASSWORD I am not able to login. Delete the
password, and I am back in the program. Now I guess I will need to talk
to the person who wrote it for us a couple of years ago because I am not
sure what is going on. Presumably as this was written for mysql 3.x
something and php 4.0.x so I guess the code has lots of things which may
now be incompatible.
Yeh sounds like the old code needs a bit of an overhaul.
PHP_AUTH_USER and PHP_AUTH_PW are set once per browser session. Try
closing & re-opening your browser. If that doesn't fix the problem with
the passwords, separate things out:
.....
$id_worker=getWorkerID($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
###### this will go into your apache error log or if php has an
error_log it will go there.
error_log('id_worker returned ' . $id_worker);
if(!isset($_SERVER['PHP_AUTH_USER']) || !$id_worker)
{
Header( "WWW-authenticate: basic realm='Workers of SGM only'");
Header( "HTTP/1.0 401 Unauthorized");
echo "You must enter a valid login ID and password to
access this system\n";
exit;
};
and go from there. If id_worker is returning something when it
shouldn't, look at that function and work out why and go "backwards" to
find the problem :)
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php