Solved

get $REMOTE_USER .htaccess

Posted on 1998-12-28
7
843 Views
Last Modified: 2013-12-25
if im running a cgi, i can get a var-env $REMOTE_USER and know the user login name... but how the experts-exchange's site put(get) my login name in their page??? how does it get my name using HTML??

   cox [edit], etc, etc
0
Comment
Question by:cox
7 Comments
 
LVL 6

Expert Comment

by:PBall
ID: 1857498
how the experts-exchange's site put my login name in your site using HTML format???

huh?

0
 
LVL 1

Author Comment

by:cox
ID: 1857499
Edited text of question
0
 
LVL 1

Author Comment

by:cox
ID: 1857500
Edited text of question
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 7

Accepted Solution

by:
yoren earned 50 total points
ID: 1857501
Cox,

The cool thing about CGI is that anything you print out gets sent back to the browser. So, just include the variable in your CGI as part of the HTML you return. Here's an example CGI in Perl:

print "Content-type: text/html\n\n";
print <<ENDOFTEXT;

<HTML>
<HEAD><TITLE>Ekspert Ekschange</TITLE></HEAD>
<BODY><H1>
ENDOFTEXT

# Did we get a REMOTE_USER environment variable?
if ($ENV{'REMOTE_USER'}) { #yes
  print "Logged in as $ENV{'REMOTE_USER'}";
}
else { #no
  print "Not logged in.";
}

print "\n</H1></BODY></HTML>\n";


0
 
LVL 1

Author Comment

by:cox
ID: 1857502
i want know if this site uses only cgis in their pages... because im reading the file htttp://www.experts-exchange.com/topic/index.htm for example, and the variable is showed....
0
 
LVL 4

Expert Comment

by:martinag
ID: 1857503
Check out Q.10109635.

Martin
0
 
LVL 7

Expert Comment

by:yoren
ID: 1857504
My guess is that the entire Expert's Exchange web site is run by CGI's (or other similar technology, like NSAPI, etc.). You can bet that even though you're specifying index.htm, you're not reading a plain HTML file. Something gave you a dynamic page. A CGI program can do this by reading the PATH_INFO environment variable, which would contain "/topic/index.html". The CGI would then parse this and understand that this path means it should display the main topic page.

There are several other technologies that can do this instead of CGI, but they all are similar in concept. A program gets the equivalent of CGI's REMOTE_USER value and returns a dynamic page.

If you want to avoid the overhead of CGI (which runs a new process for every hit), you can look into Microsoft's ISAPI, Netscape's NSAPI, or Sun's Servlet API. These all load your CGI-like program into memory and then just spawn a thread for each hit. Much more efficient.

Yuval
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

856 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