[EMAIL PROTECTED] wrote: > > On Jul 15, 11:11 am, [EMAIL PROTECTED] (Rob Dixon) wrote: >> >> [EMAIL PROTECTED] wrote: >> >>> On Jul 15, 12:32 am, [EMAIL PROTECTED] (Rob Dixon) wrote: >>>> >>>> How is this Perl programming being run? It looks like it's a CGI program or >>>> being run from a scheduler, in which case the process doesn't belong to any >>>> individual user. >>>> What are you trying to achieve by establishing the user name? >>> >>> Maybe there is another way of doing this, the purpose I try to achieve >>> is when windows users logon to their windows with user name and >>> password, then they able to access my perl program. This mean that a >>> list of authorized windows user name is store in database, so if the >>> windows user name match with the user name in database, then my perl >>> cgi program will auto login the user. >>> Really hope you can help me on this. >> >> You need to explain how your program is run. If you execute this command line >> >> perl -e "print $ENV{USERNAME}" >> >> then your username will be printed. What were you doing to get it to print >> 'SYSTEM'? And how will your users run it? >> >> Rob- Hide quoted text - >> >> - Show quoted text - > > Hi Rob, > Let me explain again, I'm hosting my perl CGI script at microsoft IIS > server. So how can I tell what user (Windows user name) called my Perl > CGI program?
The short answer is that the system has run your Perl program, as shown by the USERNAME environment variable. No one has logged in and run the program - it's being run by IIS itself in response to an HTTP request from a remote client. What you need to know is the identity of the remote user who made that request. If you have authorization configured on your server the value you need is in $ENV{LOGIN_USER} or possibly $ENV{AUTH_USER} but if those values are empty then you cannot tell who is logged in at the remote computer. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/