Jump to content


Photo

PHP, .htaccess and no authentication window popup


  • Please log in to reply
2 replies to this topic

#1 vilain

vilain
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 08 June 2006 - 08:36 PM

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.

#2 rafdre

rafdre
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 20 June 2006 - 08:00 PM

Hello,

I have the same problem...so I you have solution, please keep me posted.

regards
Rafal

#3 mainewoods

mainewoods
  • Members
  • PipPipPip
  • Advanced Member
  • 685 posts
  • LocationMaine

Posted 21 June 2006 - 02:40 AM

[!--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]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users