Computing.Net > Forums > Programming > Perl Script newbie question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Perl Script newbie question

Reply to Message Icon

Name: Thomas
Date: September 25, 2003 at 16:57:12 Pacific
OS: FreeBSD remote server
CPU/Ram: Mhz Ram
Comment:

Hello. I'm trying to install a script on a FreeBSD server. The scipt, meant to keep out hacking/brute force attempts on a password protected directory, came with very limited instructions. My question regards this line:

$HOST=$ENV{'HTTP_HOST'};

Should I have to input my domain name somewhere on this line to establish my host or does this line interpet my host name?

A few lines below this line is:

$disabto="webmaster\@$HOST";

This line serves to direct an email to the webmaster if a membership account is deactivated. Of course it should go to webmaster@mydomain.com. Again, does the first line of script above somehow declare mydomain.com without me inputting it somewhere?

Thanks in advance.




Sponsored Link
Ads by Google

Response Number 1
Name: SN
Date: September 25, 2003 at 17:09:17 Pacific
Reply:

The first line
$HOST=$ENV{'HTTP_HOST'};
assigns the environment variable HTTP_HOST to the scalar $Host. The HTTP_HOST environment variable is the hostname of your server, so if the url of the script was mydomain.com/test.pl, then $host would contain the string "mydomain.com".

I think this still works with a www or a subdomain in the url, but I'm not positive. You can tell if it is working by putting in the code:
print $ENV{'HTTP_HOST'};

and see what it outputs.

For an explanation of environment variables and a great short CGI/perl tutorial, go to CGI101.com

Best of luck,
-SN


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Perl Script newbie question

Perl script - add text to a jpg ima www.computing.net/answers/programming/perl-script-add-text-to-a-jpg-ima/3331.html

Perl Script Problem www.computing.net/answers/programming/perl-script-problem/7932.html

Perl editing Newbie www.computing.net/answers/programming/perl-editing-newbie/843.html