0

I am using both PHP and .htaccess login systems on my website.Both authentications are handled seperately(i.e php by quering database and .htaccess by including password file in root directories). PHP login directs user to the specific page and .htaccess login directs user to a specific directory that includes subdirectories and various files. As per current situation if a user wants to access directories he is required to login twice. First login directs him to a page where he finds a link and clicking on the link again prompts him to enter username and password and directs him to the directory.

Is there a way that would simplify the two authentication problem and make it one. I mean the login system should work in such a way whereif user A logs in he will be directed to the page, and if user B logs through the same login he should be directed to the directories?

Any help would be highly appreciated.

0

2 Answers 2

2

You can use the PHP_AUTH_USER and PHP_AUTH_PW values in $_SYSTEM: http://php.net/manual/en/features.http-auth.php

Sign up to request clarification or add additional context in comments.

1 Comment

same thinking here... you can then put a .htaccess rewrite rule in effect which will always check into which subfolder user requested access and verify credentials for them that way
1

You can try to log in using HTTP authentication by setting the "Authorization" HTTP header, with the value of this header set to the string basic username:password, but with the username:password portion encoded via base64_encode. Source

However, this seems like a bad design imo. Are both scripts on the same server, if yes, then they can access the same resources from the backend.

Another option you can do is switch the protection to use php: http://php.net/manual/en/features.http-auth.php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.