Search code examples
phphttpauthenticationhttp-authenticationbasic-authentication

php http authentication: ask for password every time website is loaded?


my question is:

how can i do in php, that EVERY TIME a website is loaded it asks for the http authentication and not just the first time?


Solution

  • I believe you are referring to basic auth.

    The browser provides authentication, and you have absolutely no control over it. You cannot use this method for what you are asking, you must use another.

    Technically speaking, your script shouldn't be allowing access to the resource if the browser doesn't provide proper credentials. The browser provides credentials for each resource accessed. But, the user will only be prompted once per browser usage session, generally.

    You can read about it here: http://www.php.net/manual/en/features.http-auth.php#100396