logo       

Re: Access by HTML user: msg#00500

user-groups.linux.kansascity

Subject: Re: Access by HTML user

On Fri, 31 Oct 2003, Jonathan Hutchins wrote:

> Is there a way to hide or display items on a web page according to which user
> is logged in using HTML logins?

HTML-authenticated usernames are stored in the REMOTE_USER environment
variable. If your web page is dynamically generated, you can check the
value of this variable within the script that generates the web page
content, and act accordingly, e.g.

# Inside a perl script
if $ENV{REMOTE_USER} eq "jonathan" {
print "Jonathan's secret content"
} else {
print "Nothing to see here."
}


If your web page is statically generated, you can use Apache's rewriting
engine to deliver different web pages to different users:

# Inside httpd.conf
RewriteEngine on
RewriteCond %{REMOTE_USER} !^$
RewriteRule ^/some_page.html /path/to/${REMOTE_USER}s_page.html

If you're logged in as "jonathan" this will replace the contents of
"some_page.html" with "jonathans_page.html"


If you have server side includes enabled, you can alter the contents of a
web page on the fly like so:

<!-- Inside a web page -->
<!-- #if expr="$REMOTE_USER = jonathan" -->
Jonathan's secret content
<!-- #else -->
Nothing to see here.
<!-- #endif -->

It sounds like the last one is what you're looking for.



KC Linux Users Group -- to unsubscribe send mail to
majordomo-3DadQFcgQnvYtjvyW6yDsg@xxxxxxxxxxxxxxxx
Enter without the quotes in body of message "unsubscribe kclug"



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise