ProblemYou want to know the name of the user who has authenticated. SolutionConsult the environment variable REMOTE_USER. In a Server-Side Include (SSI) directive, this may look like: Hello, user <!--#echo var="REMOTE_USER" -->. Thanks for visiting. In your CGI code, it might look like: my $username = $ENV{REMOTE_USER}; DiscussionWhen a user has authenticated, the environment variable REMOTE_USER is set to the name with which she authenticated. You can access this variable in CGI programs, SSI directives, PHP files, and a variety of other methods. The value will also appear in your access_log file. Note that, while it is the convention for an authentication module to set this variable, there are reportedly some third-party authentication modules that do not set it, but provide other methods for accessing that information. See Also
|