The question is about CGI environment variables and perl CGI.pm for that
matter, so he should be able to ask this list for help.
Also, this is not server specific. It's same on Apache and IIS.

The remote_user() or user_name() is only set when the visitor is required by
the web server to authenticate using a login name and password. So if your
script or the URL the visitor ask for is not password protected, then the
remote_user() or user_name() will return undefined.

Refer to perldoc CGI for more about remote_user() or
http://www.cgi101.com/book/ch3/text.html for CGI environment variable. I hop
e you will get answer to most of your problems.

Mimi

On 16/07/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> On Jul 15, 11:36 pm, [EMAIL PROTECTED] (Mimi Cafe) wrote:
> > remote_user() or user_name() should give you the name of the user if you
> are
> > using CGI.pm.
> >
> > Mimi
> >
> > On 15/07/2008, [EMAIL PROTECTED] <[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?
> >
> > > Please advice.
> >
> > > Thanks.
> >
> > > --
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >http://learn.perl.org/- Hide quoted text -
> >
> > - Show quoted text -
>
> Hi Mimi,
>
> Below is the code I try in my apache server at windows XP, but it
> return null for both remote_user() or user_name().
>
> #!C:\Perl\bin\perl
> use CGI;
> my $query = new CGI;
> my $userName= $query->user_name();
> my $remoteUser = $query->remote_user();
> print "Content-type: text/html\n\n";
> print "<h2>User Name</h2> $userName\n";
> print "<h2>Remote User</h2> $remoteUser\n";
>
> Leo.
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>

Reply via email to