Click to See Complete Forum and Search --> : Getting a USERS LOGIN NAME


SniperX
06-04-2003, 07:55 AM
Hi there AGAIN - the second time today...
I was wondering if it is possible to get the users login name (whether on a mac/windows/unix/linux machine)?
IF it is could you please enlighten me...

Regards and Thanks in advance

DJ MAtty

cmelnick
06-04-2003, 10:40 AM
Depends on what language you are using. With Perl & the CGI.pm module you would do something like:


#!/usr/bin/perl
use CGI;
my $cgi = new CGI();
print $cgi->header;

if (! $cgi->remote_user) {
print "You don't have access";
exit;
} else {
print "User is: " . $cgi->remote_user;
}


That was off the top of my head, so something might be erroneous. This assumes, however, that you have authenticated the user using the servers authentication, not your own custom login script.