Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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.

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

![]() |
![]() |
![]() |

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