I just requested MYSQL at my hoster, so database access is coming up...
(I asked the question above because I first wanted to extract only the data for europe due to the fact that I didn't have access to a sql-database. But now I have access, I can just install it all...)
My only problem is: I NEVER WORKED WITH SQL before... (I'm pre-sql ;-)
Therefore I would like to know where I can get good information to add this single line into a short perl I use to determine the referer...
Code:
SELECT country FROM ip2nation WHERE ip < INET_ATON('<ip>') ORDER BY ip DESC LIMIT 0,1;
I now use: (the script runs on first pagina (index.html) so all other pages can access this info later on.)
Code:
my $in = new CGI;
my $string = $in->param('ID');
my $referer = $ENV{'HTTP_REFERER'};
$referer =~ s|^http://([^/]+).*|$1|i;
my $country = $sqllookup
my $cookie = $country . "-" . $referer
my ($crypt, $random, $id);
$crypt = join ("-", map { ord } (split //, $cookie));
($string =~/-/) ? ($random,$id) = split(/-/,$string) : $id = $string;
my $cookie = $in->cookie(
-name => 'id',
-value => $crypt,
-domain => '.domain.com',
-expires => '+12h',
-path => '/'
);