PHP basic authentication set up

Hello, I would like to set up PHP and Apache configuration for PHP basic authentication. What do I need to configure it? Version php 4.4.7, Apache 1.3.37, MySQL 4.0.27-standard.

Best Regards, portal123
portal123Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dr_dedoCommented:
some nice step by step how to is here, it explains every little thing all the way
http://www.codewalkers.com/c/a/Miscellaneous/Writing-a-Basic-Authentication-System-in-PHP/1/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
portal123Author Commented:
Thank, dr_dedo. but I prefer to use $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] without session

and generate query from a mysql table that contains user id and password. comparing $_POST variables with user id and password at the query.  I made the following code and it works well at a previous server, but I've changed a new server and it does not work on it.

So, I guess probably some setting problems on Apache and PHP.

Do I need to set anything on PHP and Apache when I use $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] on them ??
0
jmlonCommented:
The method given in the article pointed out by dr. dedo exemplifies the process of implementing the authentication process as part of the application itself via html forms.

On the other hand, if you are using the PHP module (not CGI), you may implement HTTP-protocol authentication. The difference is that the browser will pop-up an username/password window and the script will be able to handle the authentication itself. A complete example of this may be found in:
http://www.php.net/features.http-auth

Finally, authentication may be handled entirely by the web server (Apache). The documentation about how to do this is here:
http://httpd.apache.org/docs/1.3/howto/auth.html
Notice that when authentication is handle this way, you may use one of several apache modules to handle the username/password database, such as mod_auth_db for using a database.

One more note: It is recommended to use digest authentication (as opposed to basic authentication) because in this mode the password does not traverse the network.
0
portal123Author Commented:
I made a simple mistake on $_SERVER['PHP_AUTH_PW']. I wrote not $_SERVER['PHP_AUTH_PW'] but $_SERVER['PHP_AUTH_PWD'] .

Anyway, thanks both guys....
for($i=1; $i<=100; $i++){
echo "THANKS";
echo "<BR />";
}
Best Regards, portal123
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.