Solved

Using Javascript and .htaccess

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

747 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

10 Experts available now in Live!

Get 1:1 Help Now