apacheguy Posted August 17, 2008 Share Posted August 17, 2008 Hello - I am currently working on a very simple script in perl. Here is the code: #!/perl/bin/perl.exe use String::Random qw(random_regex random_string); open FILE, "+>", "$ENV{'REMOTE_USER'}.INI" or die $!; print FILE str; print FILE " str4"; print FILE random_regex('\d\d\d'); close FILE; print <<HTML; Content-type: text/html <html><head><title>Success</title></head><body bgcolor=white> <h1>User Created</h1> HTML The script runs fine, but gets tripped up at $ENV{'REMOTE_USER'}. It creates a file with a blank name (ie .ini) instead of admin.ini, which is the user that is logged in when I run the script. Any ideas as to why it is not displaying the remote user in the file name? Quote Link to comment https://forums.phpfreaks.com/topic/120118-solved-perl-environment-variables-question/ Share on other sites More sharing options...
apacheguy Posted August 18, 2008 Author Share Posted August 18, 2008 Upon further analysis of the problem I discovered that perl is having problems just called the remote_user variable. I got this script from the apache documentation to test it: #!/perl/bin/perl.exe my $REMOTE_USER = $ENV{'REMOTE_USER'}; print "Content-Type: text/html\n\n"; print "The authenticated user is $REMOTE_USER\n"; No luck printing the remote_user! Quote Link to comment https://forums.phpfreaks.com/topic/120118-solved-perl-environment-variables-question/#findComment-618879 Share on other sites More sharing options...
apacheguy Posted August 18, 2008 Author Share Posted August 18, 2008 Problem Solved! It turned out that the script was not placed in a protected directory. Thus, it was not able to call remote_user. Quote Link to comment https://forums.phpfreaks.com/topic/120118-solved-perl-environment-variables-question/#findComment-619236 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.