
April 28th, 2000, 05:39 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
## host should give the value of $ENV{'REMOTE_HOST'}, otherwise, it will use $ENV{'REMOTE_ADDR'}
## so in this example, $host is the host while $ip is for $ENV{'REMOTE_ADDR'} in short form
$ip = $ENV{'REMOTE_ADDR'};
$n = `nslookup $ip | grep Name`; chop($n);
$host = substr($n, rindex($n, " ")+1);
if ($host eq "") {
$host=$ENV{'REMOTE_ADDR'};
}
>>But we need it to give them country related news first and global news latter on our home page
There are two ways you should do. You can download and install this http://www.perl.com/CPAN-local/modules/by-module/Net/Net-Country-0.1.tar.gz
If your site is hosted at someone's server, you can simply place this Country.pm under any subdirectory of your account. For example: /html/your_account/libdata/Net/Country.pm
Next, put the following line in your script:
use lib "/html/your_account/libdata";
use Net::Country;
If you will install Net-Country on your own server, the lib path should be in your path, so you don't need to use the "use lib..." line.
The other way is to use http://www.apache.org/docs/mod/mod_mime.html#addlanguage . Also take a look at ENV{'ACCEPT_LANGUAGE'}, but it might not give you a value.
|