?
Solved

Using Javascript and .htaccess

Posted on 1997-08-12
4
Medium Priority
?
305 Views
Last Modified: 2008-03-10
Is there a way using JavaScript to get the username of someone who logs into a page protected by a htaccess file?  I would just use CGI for this (the REMOTE_USER environment variable), but for some strange reason my server isn't configured to use htaccess under the cgi-bin directory.
0
Comment
Question by:jgottden
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Expert Comment

by:srudy
ID: 1268938
The only way to get this information, due to javascript's limited security is to call an external program.  I would say you should try to figure out why you can't access the REMOTE_USER variable and go from there.

If you are using Netscape Enterprise server and LiveWire there is a way to call an external C library and access the REMOTE_USER variable as well.  I have the code for that method.  However it sounds like you know how you are going to get the information from using CGI scripting, so you should proably just stick to that solution.

Good luck...

Scott Rudy
0
 
LVL 1

Expert Comment

by:909233
ID: 1268939
In Javascript you may not necessarily get the username but you
most certainly can obtain the user's browser/ip address
0
 
LVL 5

Expert Comment

by:Christian_Wenz
ID: 1268940
i don't know why you rejected srudys' answer - it was obviously correct!
0
 
LVL 1

Accepted Solution

by:
gabsi earned 100 total points
ID: 1268941
U have to use a protected CGI ie: a CGI which needs authentification to be accessed.
Than the REMOTE_USER variable can be used.
Note that REMOTE_USER variable does not mean the useridentification on his own machine. Only AS WHO is he known for your CGI.The value of this variable is file/directory dependant:
A same user may have 2 differents REMOTE_USER values for 2 cgi which have different access rules.
I dont see how does your server refuse to protect some directories you want to (cgi or others).
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question