Page 1 of 1

Apache Authentication help

Posted: Mon Feb 02, 2009 12:01 am
by TangerineCheese
I am working with a setup that requires using .htaccess and .htpasswd to restrict access to a directory. I have a mysql database with a list of users. I can successfully authenticate the user using the database, and i can add the user to .htpasswd in the proper username:password format, but how do i tell apache who this person is?

I want to redirect the authenticated user to the protected directory without having the user/pass box pop up in the browser, since i just got that same information with my own form. I have their username and I have their password, how do I pass this information on to the server so the user doesn't get hassled for it a second time?

My goal is that the box in the image below never actually appear to the user, but be handled by the script.
Image

I tried doing this, but it still asks me for a username and password

Code: Select all

        $_SERVER[PHP_AUTH_USER] = $user;
        $_SERVER[PHP_AUTH_PW] = $pass;
        $_SERVER[AUTH_TYPE] = 'Basic';
Any help would be much appreciated!