Javascript or HTML to retrieve apache username

I have a internal wesbite set up and any visitor must enter username / passwd as defined in apache (I've set these up using htpasswd)

I use cgi scripts set up using ksh or javascript to populate pages / tables etc.

I want to be able to get the apache username that the used authorised themselves with, so I can display this on the webpage. ie. something like "You are logged in as xxxx"

Can I get this username using HTML, Javascript or something else?

Server version: Apache/1.3.31 (Unix)

You can get this easily with the PHP $_SERVER globals.

1 Like

if you use HTML / Javascript in your program , you can Use AJAX.

Ajax exactly does your need.

Thanks - worked perfectly !