Solved

Using Javascript and .htaccess

Posted on 1997-08-12
4
275 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
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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

912 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now