Hi All, Is there a way to pick a "username" or "email address" with LDAP and CGI? I have this code that works fine when running just as a Perl program. It gets me the logon ID of the user and I user it in the LDAP routine to find the user email address.
But if I run it as a CGI program, I cannot get get the username nor the user email address. I've tried all kind of user environment variable($ENV{'REMOTE_ADDR'}, ... ) still cannot get the email address. Is there something I need to configure in Apache? Please help James #!c:/Perl/bin/perl use CGI ':standard'; use Net::LDAP; $ldap = Net::LDAP->new( 'ldap.mycompany.com' ) or die "$@"; $mesg = $ldap->bind; print header; $user = &Win32::LoginName; print "---$user--\n"; $mesg = $ldap->search( # perform a search base => "o=hp.com", filter => "(&(ntUserDomainId=$user) (o=My Company))" ); $mesg->code && die $mesg->error; my($entry); @all = $mesg->entries; foreach $ent (@all) { foreach $att (sort $ent->attributes ) { if ( $att =~ m!\bmail\b! ) { print "<h1>$att ----- " . $ent->get_value($att) . "</h1>"; } } } _______________________________________________ Perl-Win32-Web mailing list Perl-Win32-Web@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs