Find username of user running the script

Hello All,

If I have a simple cgi script and want to find the name of the person accessing the page, is it possible? How do I get the name of this user? Please help.

I was trying a vague method but it doesn't seem to work with all browsers and versions ...

$val=$ENV{'HTTP_COOKIE'};
$name = (split ('=',(split(';',$val))[1]))[1];
print "$name";

Regards,
garric

This information is not transmitted over HTTP/CGI. If you mean the local user executing the CGI script on behalf of the visitor, then that should be whatever user is running the HTTP daemon, and will not change from one invocation to the next.

If you are setting cookies, then whatever is in those cookies is of course accessible to you, but if you don't know a user in the first place, you cannot get their name into a cookie.