Need to get the USER that logged in...

I have a program that runs on a Secure server.  The user types in a URL that looks somewhat like this..

https://joe:snuffy@www.whatever.com/program.pl

I need program.pl to be able to get JOE out of that.  The server itself will take care of actually authenticating the user, I just want to be able to grab the user name.  I thought $ENV{REMOTE_USER} was the way to get that but so far it isn't working..
Is that the correct way to get that information and if not, how do I get it?

Thanks

-Pal

LVL 4
PalamedesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

guadalupeCommented:
Try this code:

#!/usr/local/bin/perl

print "Content-type: text/html\n\n";

foreach (keys %ENV)
{
print "Key: $_  ==> Value: $ENV{$_}<br>";
}


It will show you what vars are available.  Make sure to put it in a protected place that forces a log in and ten you'll see if an env var is being created by you server which will work.  Remember that not all servers create the same CGI Env Vars so this shows what ones DO exists.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
maneshrCommented:
try this

#!/usr/local/bin/perl

use CGI;

print "Content-type: text/html\n\n";

$ENV{SERVER_URL}="https://joe:snuffy\@www.whatever.com/program.pl";

$ENV{SERVER_URL}=~ /https:\/\/(.*):.*@.*/;
print $1,"<br>\n";  ##OUPUT will be joe

#### OR YOU CAN USE THIS#########
@tmp=split(/:/,$ENV{SERVER_URL});
$tmp[1]=~ s/\/\///g;
print $tmp[1],"<br>\n";##OUPUT will be joe
0
PalamedesAuthor Commented:
Thanks Guadalupe.. Thank showed it.. it's AUTH_USER  ... sheesh..

-Pal

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.