PHP_AUTH_USER & .htaccess
PHP_AUTH_USER & .htaccess
am 06.03.2007 09:02:42 von Mike van Hoof
--------------020006030501010101040509
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hello,
I've got a really strange problem, and hope this is the right list to
post to.
I got a website with a login, which uses a .htaccess file for
autentication. That part works like a charm. But when i want to read the
loggin details with PHP, the variable $_SERVER['|PHP_AUTH_USER'] isn't
set (in the directory where i logged into)
when i go a directory back, and view a phpinfo() there i see
|$_SERVER['|PHP_AUTH_USER']|| is set, so i do a phpinfo() in the
directory with the .htaccess and it is gone.
Had anyone ever had experience with this, because i can't find a solution.
- Mike|
--------------020006030501010101040509--
Re: PHP_AUTH_USER & .htaccess
am 06.03.2007 09:17:01 von Mike van Hoof
--------------020502040506030305090509
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
This must be set on "On", because in a directory where the .htaccess
file doesn't exist it works, or can that setting also be set to on?
- Mike
bedul schreef:
> ----- Original Message -----
> From: "Mike van Hoof"
> To:
> Sent: Tuesday, March 06, 2007 3:02 PM
> Subject: [PHP-DB] PHP_AUTH_USER & .htaccess
>
>
>
>> Hello,
>>
>> I've got a really strange problem, and hope this is the right list to
>> post to.
>>
>> I got a website with a login, which uses a .htaccess file for
>> autentication. That part works like a charm. But when i want to read the
>> loggin details with PHP, the variable $_SERVER['|PHP_AUTH_USER'] isn't
>> set (in the directory where i logged into)
>>
>> when i go a directory back, and view a phpinfo() there i see
>> |$_SERVER['|PHP_AUTH_USER']|| is set, so i do a phpinfo() in the
>> directory with the .htaccess and it is gone.
>>
>> Had anyone ever had experience with this, because i can't find a solution.
>>
>> - Mike|
>>
> i do believe this can only be answer by your webadmin.. since this might not
> your local but using web right??
> try ask to them are the php_auth_user is set ON
>
>
--------------020502040506030305090509--
Re: PHP_AUTH_USER & .htaccess
am 06.03.2007 09:17:04 von bedul
----- Original Message -----
From: "Mike van Hoof"
To:
Sent: Tuesday, March 06, 2007 3:02 PM
Subject: [PHP-DB] PHP_AUTH_USER & .htaccess
> Hello,
>
> I've got a really strange problem, and hope this is the right list to
> post to.
>
> I got a website with a login, which uses a .htaccess file for
> autentication. That part works like a charm. But when i want to read the
> loggin details with PHP, the variable $_SERVER['|PHP_AUTH_USER'] isn't
> set (in the directory where i logged into)
>
> when i go a directory back, and view a phpinfo() there i see
> |$_SERVER['|PHP_AUTH_USER']|| is set, so i do a phpinfo() in the
> directory with the .htaccess and it is gone.
>
> Had anyone ever had experience with this, because i can't find a solution.
>
> - Mike|
i do believe this can only be answer by your webadmin.. since this might not
your local but using web right??
try ask to them are the php_auth_user is set ON
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: PHP_AUTH_USER & .htaccess
am 06.03.2007 16:49:37 von Dwight Altman
Typo?
$_SERVER['|PHP_AUTH_USER'] != $_SERVER['PHP_AUTH_USER']
Notice the pipe "|" before "PHP_AUTH_USER"?
Regards,
Dwight
> -----Original Message-----
> From: Mike van Hoof [mailto:mike@medusa.nl]
> Sent: Tuesday, March 06, 2007 2:03 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] PHP_AUTH_USER & .htaccess
>
> Hello,
>
> I've got a really strange problem, and hope this is the right list to
> post to.
>
> I got a website with a login, which uses a .htaccess file for
> autentication. That part works like a charm. But when i want to read the
> loggin details with PHP, the variable $_SERVER['|PHP_AUTH_USER'] isn't
> set (in the directory where i logged into)
>
> when i go a directory back, and view a phpinfo() there i see
> |$_SERVER['|PHP_AUTH_USER']|| is set, so i do a phpinfo() in the
> directory with the .htaccess and it is gone.
>
> Had anyone ever had experience with this, because i can't find a solution.
>
> - Mike|
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP_AUTH_USER & .htaccess
am 06.03.2007 18:34:23 von Micah Stevens
This function doesn't work if you're using the CGI version of PHP. Check
for that - it may be responsible.
-Micah
On 03/06/2007 12:02 AM, Mike van Hoof wrote:
> Hello,
>
> I've got a really strange problem, and hope this is the right list to
> post to.
>
> I got a website with a login, which uses a .htaccess file for
> autentication. That part works like a charm. But when i want to read
> the loggin details with PHP, the variable $_SERVER['|PHP_AUTH_USER']
> isn't set (in the directory where i logged into)
>
> when i go a directory back, and view a phpinfo() there i see
> |$_SERVER['|PHP_AUTH_USER']|| is set, so i do a phpinfo() in the
> directory with the .htaccess and it is gone.
>
> Had anyone ever had experience with this, because i can't find a
> solution.
>
> - Mike|
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: PHP_AUTH_USER & .htaccess
am 12.03.2007 09:08:49 von Haydar TUNA
Hello,
You can use HTTP_AUTH without .htaccess file. It is very easy. You can
use like following example on your web site.:)
if ( ( !isset( $_SERVER['PHP_AUTH_USER'] )) ||
(!isset($_SERVER['PHP_AUTH_PW'])) || (
$_SERVER['PHP_AUTH_USER'] != 'username' ) || (
$_SERVER['PHP_AUTH_PW'] != 'password' ) )
{
header( 'WWW-Authenticate: Basic realm="My Private Area"' );
header( 'HTTP/1.0 401 Unauthorized' );
echo "
Authorization Required.
";
exit;
}
else
{
session_start();
session_register("sessionpass");
$_SESSION["sessionpass"]="1";
header( 'Location: http://www.somehostname.com/filename.php');
}
?>
In this example, If the user and password are right, You can set
$_SESSION["sessionpass"]="1" and then you can control this variable
beginning of the PHP file like following.
Begining of the filename.php
session_start();
if (!session_is_registered ('sessionpass'))
{
echo "Authorization Required.
";
exit;
}
..........
..........
..........
..........
?>
"Mike van Hoof" wrote in message
news:45ED2022.6040906@medusa.nl...
> Hello,
>
> I've got a really strange problem, and hope this is the right list to
> post to.
>
> I got a website with a login, which uses a .htaccess file for
> autentication. That part works like a charm. But when i want to read the
> loggin details with PHP, the variable $_SERVER['|PHP_AUTH_USER'] isn't
> set (in the directory where i logged into)
>
> when i go a directory back, and view a phpinfo() there i see
> |$_SERVER['|PHP_AUTH_USER']|| is set, so i do a phpinfo() in the
> directory with the .htaccess and it is gone.
>
> Had anyone ever had experience with this, because i can't find a solution.
>
> - Mike|
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php