Jump to content

PHP, .htaccess and no authentication window popup


vilain

Recommended Posts

Hello,

Here is the deal. I want to be able, from PHP, to set $PHP_AUTH_USER and $PHP_AUTH_PW so that the authentication window wont pop up when accessing the protected (with .htaccess) directory. The authetication is done with PHP, so I don't want to have to enter a user name and password again when I access the directory.

My code looks like this but it won't work. This code is executed in a non-protected directory and then it gets redirected to a protected directory (projectPath).

$PHP_AUTH_USER = $user;
$PHP_AUTH_PW = $pass;

session_start();

session_register("PHP_AUTH_USER");
session_register("PHP_AUTH_PW");

header( 'Location: ' . $_SESSION['projectPath'] );
exit;

Someone managed to do that already?

Thanks.
Link to comment
Share on other sites

  • 2 weeks later...
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]The HTTP Authentication hooks in PHP are only available when it is running as an Apache module and is hence not available in the CGI version.[/quote]
[a href=\"http://www.php.net/manual/en/features.http-auth.php\" target=\"_blank\"]http://www.php.net/manual/en/features.http-auth.php[/a]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.