473,378 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

.htaccess & .htpasswd

Hello to all,

I have protected a directory with the help of .htaccess &
htpasswd.

I also read that I can get the login value in a php
variable.

Like this:
$user = $_SERVER['PHP_AUTH_USER'];
echo "User : ";
echo $user;

I did it, but nothing is displayed after the echo User!
I don't really know if it's the right way to get this
value.
Could somebody give me some help.

Regards

Otto


Jul 17 '05 #1
2 2640
Otto <oh****@freesurf.ch> wrote in news:VA******************@freesurf.ch:
Hello to all,

I have protected a directory with the help of .htaccess &
htpasswd.

I also read that I can get the login value in a php
variable.

Like this:
$user = $_SERVER['PHP_AUTH_USER'];
echo "User : ";
echo $user;

I did it, but nothing is displayed after the echo User!
I don't really know if it's the right way to get this
value.
Could somebody give me some help.


That is the correct way to determine the .htpasswd user's username. In
order for it to work, the script must be located somewhere inside of the
..htpasswd protected directory, and a valid authenticated user must be
logged in.

If this all sounds right, and it still isn't working, what is the setup
of your web server?

It looks like some early versions of PHP5 had a problem with $_SERVER
[PHP_AUTH_USER] :

http://bugs.php.net/bug.php?id=29132

If you're using PHP5, make sure you have the latest release.

hth
--

Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg'); Web :
shaunc.com
--------------------------
|--------------------------------------------------
<http://www.phplabs.com/> | PHP scripts and thousands of webmaster
resources!
Jul 17 '05 #2
Hello Jay
If you're using PHP5, make sure you have the latest release.

Many thanks four your quick answer. I have to look with
version my webhoster are using!

Regards

Otto

Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lothar Bayer | last post by:
Hallo, I want zu install a security-path with .htaccess and .htpasswd on my privat local machine (for test-reason) I succeeded with a .htaccess and Error 404-adressing a special Error-page with...
3
by: starlightjen | last post by:
Hello, I'm trying to use php to update my htpasswd file. I have my permissions on .htpasswd set to 777, so it should be wide open. From the command line (when logged into the server as...
0
by: Ludwig77 | last post by:
I'm trying to password protect a directory on my web site. I'm using the password encryption generator located at http://resma.net/tutorials/htaccess.php# I can't seem to get my login to work. I...
1
by: nickyeng | last post by:
I have checked this info from apache website, and i confused with it. Procteing System files it said: To run a really tight ship, you'll want to stop users from setting up .htaccess files...
1
by: Nosferatum | last post by:
Is it possible to make a custom php-form to log in to a protected folder with .htaccess/htpasswd? (Just wonder if it's possible to avoid the ugly standard server popup- login form).
0
by: Jankie | last post by:
Good morning everyone Am hopeful that someone can share me some advice as to the best .htaccess example for a site under development. When i use something like this: <Limit GET POST> ...
1
by: paitoon | last post by:
Helle I have problem about .htaccess in my site. My purpose is i want to protect a folder name's IMAGES in my site then i put .htaccess into that folder. But instead of the IMAGES folder will...
0
by: adamjblakey | last post by:
Hi, I have a folder on my server which i want to protect. I though everything is setup fine and does protect the folder but also protects the public_html also even though the htaccess file is in a...
8
by: Geoff Cox | last post by:
Hello Can anyone recommend software which I can run from my own PC which will create the encrypted password for the htpasswd file? I have come across Htpasswd Generator which does the job but...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.